Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
foxfluff
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
36 ms
·
301.
▲
by
foxfluff
5y ago
> If something is needed in pretty much every program, it should be a part of the language or the standard library. It sure would be convenient that way. That said, you don't need to convert strings in pretty much every program. T
302.
▲
by
foxfluff
5y ago
> Sure, you can't get away from handling the cases, but as the article clearly demonstrates, there can be a much better interface for it. It's a very apples to oranges comparison, to the point that it almost feels like a straw
303.
▲
by
foxfluff
5y ago
Call me old fashioned but I'd prefer to just make it impossible to write the firmware without physical access. Verification just brings it's own issues and is not a panacea. Who owns the key(s)? If not you, how do you trust them
304.
▲
by
foxfluff
5y ago
Is it formal methods to conclude that the vast majority of arithmetic, which for the software I typically write consists of iterators and buffer offsets dealing with fixed size buffers, can never overflow an int? Is it formal methods when
305.
▲
by
foxfluff
5y ago
No, they're definitely features. The removal of null pointer checks in gcc is enabled by -fdelete-null-pointer-checks and is often enabled by default.
306.
▲
by
foxfluff
5y ago
They mean the abstract machine, in terms of which the semantics are defined.
307.
▲
by
foxfluff
5y ago
That's a nice example. It'd definitely be nice to have a warning for this one. Fwiw GCC does have a related warning flag (-Wnull-dereference) but I'm not sure it's made exactly for this. I believe it works based on fun
308.
▲
by
foxfluff
5y ago
> People claim that exploiting UB gives 1-2% speedup and that that's important. What they conveniently leave out is that you only get that speedup when your code has UB, which means that you only get that speedup when your code has
309.
▲
by
foxfluff
5y ago
I think they're trying to say that if your language prevents aliasing (i.e. pointers by definition do not alias and it is impossible to make them alias), then the compiler doesn't need to worry about it. C doesn't prevent
310.
▲
by
foxfluff
5y ago
Optimizations often deal with inlined code. The code in the inlined function might be fine in the general sense, but once taken in a particular context, there's dead or redundant code because the compiler can deduce values from contex
311.
▲
by
foxfluff
5y ago
> If people really want the optimizations afforded by things like assuming an int can't overflow to a negative number in a for loop, my personal position is that the code should be annotated such that the optimization is enabled. Th
312.
▲
by
foxfluff
5y ago
> At least in compilers like gcc, optimization needs to be enabled to get sane warnings emitted by the compiler, so some people are indeed being forced to pass in -O2 to get sane build warnings for projects. That's a fair point and
313.
▲
by
foxfluff
5y ago
> In some sense, the problem isn't that the compiler "can't" detect that an integer addition will overflow. It absolutely can't if it doesn't know what the values are going to be. > the compiler will have
314.
▲
by
foxfluff
5y ago
> However, this optimization is valid because writing to a null pointer is undefined... if writing to a null pointer trapped (SIGFAULT), which is what it actually does at runtime, then the optimization would be incorrect... because you c
315.
▲
by
foxfluff
5y ago
Point it out to the authorities and hope the company gets smacked with a huge fine and makes it to this list: https://www.enforcementtracker.com/
316.
▲
by
foxfluff
5y ago
That's not true at all. Compilers can detect some instances of UB, and they will happily warn when they do. Most instances of UB are ones that the compiler could not detect. Your compiler isn't going to detect that your integer
317.
▲
by
foxfluff
5y ago
> Can you still compile gcc code with -O0 (gcc option to turn optimization off) to get completely defined behavior? No. The standard specifies what's undefined, optimization levels don't change it (though there are compiler fl
318.
▲
by
foxfluff
5y ago
> Is it even possible to have zero undefined behavior in languages that allow user-defined pointers? It kinda boils down to what exactly you mean by defined behavior. A C programmer's take might be that you can run a conforming pro
319.
▲
by
foxfluff
5y ago
Yeah, it'd be nice if we could solve the halting problem.
320.
▲
by
foxfluff
5y ago
> And specifically for C, unsafe optimizations are supposed to only apply with -O3. Level 2 is supposed to be safe. Citation needed? AIUI optimization levels are entirely up to the compiler. GCC's man page says nothing about the s
321.
▲
by
foxfluff
5y ago
I don't see it that way. Isn't that precisely the point of higher levels? Don't go there if you don't know what you're doing. Since we can't magically install knowledge into average programmer's heads,
322.
▲
by
foxfluff
5y ago
Do you think people understand Rust?
323.
▲
by
foxfluff
5y ago
I haven't got the time to read the paper yet but I believe I'd emerge with the more or less the same opinion that I've had before: nobody's forcing you to pass -O2 or -O3. It's stupid to ask the compiler to optimiz
324.
▲
by
foxfluff
5y ago
This was discussed somewhat recently: https://news.ycombinator.com/item?id=28779036
325.
▲
by
foxfluff
5y ago
> I see and hear of GDPR violations everywhere (here in the UK, pre and post Brexit). Despite the threat of legal action, companies still ignore (too small to care) or are ignorant of the rules. It was wild west before GDPR, it takes tim
326.
▲
by
foxfluff
5y ago
Well, if they don't target ads based on religion, they don't need to give a crap what your religion thinks about ads :)
327.
▲
by
foxfluff
5y ago
This is a nice proposal overall. I'm not sure I agree with the bans on health, religion and sexual orientation (depending on your point of view such ads can be exploitative or useful) but I agree that targeting minors is not cool, and
328.
▲
by
foxfluff
5y ago
The proposal still allows you to consent to targeted advertising. However targeting minors and certain protected groups is not allowed. So if you think targeted ads can be a net positive to your life, I have good news: you can still consen
329.
▲
by
foxfluff
5y ago
This proposal bans all targeted ads unless you give consent. Targeting minors and certain protected groups is banned even if they consented to targeted advertising. There's also this gem: In order to avoid fatiguing recipients w
330.
▲
by
foxfluff
5y ago
> How much of your choice in products is based on word of mouth? How do you know those purchases are not as a result of ads. So what if they are? GP's point still stands. When buying products, I often want a first hand experience
More ›