Re:GCC 6.1 Released
by pjmlp on Wednesday April 27, 2016 @09:25AM
(#11580171)
And I challenge you to find someone that knows all C rules about UB across all major compilers.
[ Parent
| on HN ]
Undefined behaviour is the same across all compilers. The compilers aren't the things which make the behaviour undefined, its the C standard.
No it is not, if you ever tried to write portable C code you should clearly be aware that each C compiler has its own flavor of undefined behavior.
The C standard is very generous in terms of undefined behavior freedom.
By definition made in the C Standard, undefined behavior is: behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
for which this International Standard imposes no requirements
If you're using some other definition, then say so, otherwise your comments make no sense.
Given my-app.c, each C compiler out there will pick a different UB subset and not everything that is defined as UB in the standard.
They are free to do that and still be compliant, after all UB means anything goes.
That compilers may behave differently is exactly the point of UB, if they all had to behave the same it wouldn't be undefined, after all!
True dat. C is a smaller language and is possible to know the whole language, but not the whole spectrum of UB. C++ is a vastly larger language it is nearly impossible to know the whole language, but much more likely to understand the spectrum of UB.