Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
MushyQuadrant
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
MushyQuadrant
4y ago
The first form has no undefined behavior. Since p may be NULL, in general the compiler is not allowed to make that transformation unless it can prove bar never gets called with p=NULL and n=0 (which it probably can't). If the compiler
2.
▲
by
MushyQuadrant
4y ago
This is a necessary consequence (in the formal logic sense) of the "principle of explosion"[1] for optimizing compilers. If the compiler assumes some undefined behavior does not occur, but in fact that undefined behavior does occu
3.
▲
by
MushyQuadrant
4y ago
> I cannot say I have ever written anything that ran into or caused undefined behavior. And I have programmed for a long time. Perhaps this is true, or perhaps you are just unaware of the undefined behavior you have relied on. What I can
4.
▲
by
MushyQuadrant
4y ago
Yes, thank you. It's clear these points are incorrect if you consider the purpose of undefined behavior. Compilers are allowed to assume undefined behavior is never invoked (which may be useful for optimization and other reasons); it
5.
▲
by
MushyQuadrant
4y ago
No there aren't. I have no doubt the people you describe exist, but "vegan hunter" is a complete oxymoron unless you're talking about "hunting" berries. Even descriptivist dictionaries don't include any de