News for hackers. Stuff that matters.
Re:A glimpse of undefined behavior in C by brihat on Saturday November 30, 2013 @06:08PM (#6825096)
Isn't this actually called "implementation-defined" behaviour in the std rather than "undefined" behaviour? I generally get a segfault for undefined behaviors
Re:A glimpse of undefined behavior in C by twoodfin on Saturday November 30, 2013 @08:08PM (#6825553)
It's undefined. That means the compiler and runtime can choose to segfault, do something that looks right, silently corrupt your program, launch the nuclear missiles, whatever. And there's no requirement that this behavior be repeatable, so the code can work with debug flags turned on but fail in a release build.

You can never rely on your compiler's implementation of undefined behavior.

Re:A glimpse of undefined behavior in C by ygra on Sunday December 01, 2013 @10:05AM (#6827488)
> You can never rely on your compiler's implementation of undefined behavior.

I wish I could somehow get my coworker to understand this. He's mostly "Yeah, well, I know it's undefined, but there's really no way this could be anything else than <foo>. I know what the CPU does there."

Re:A glimpse of undefined behavior in C by scott_w on Saturday November 30, 2013 @06:22PM (#6825140)
I believe this is undefined because the standard doesn't say what a "sequence point" is and not "a sequence point is implementation defined". I'm going from second-hand knowledge and it's been years since I looked at C (and never past a high school level of understanding).