3 ms·
> That would not be the first time that GCC treats undefined behaviors in the least possibly helpful way, Oh compilers. Like VC++6.0 initializing uninitialized
by balls187 9y ago
> That would not be the first time that GCC treats undefined behaviors in the least possibly helpful way,
Oh compilers. Like VC++6.0 initializing uninitialized memory to 0xCDCDCDCD in DEBUG.
- tvgggghh 9y agoErr, that's on purpose? It's so you can tell your writes apart, which is helpful while debugging. They used to use, uh, more obvious patterns but the PC brigade called them on it so they settled on 0xcd.
- qb45 9y agoUm, what was it? You can paste in decimal to avoid triggering the PC brigade ;)
- detaro 9y agoWikipedia has a list that includes some used values: https://en.wikipedia.org/wiki/Hexspeak https://en.wikipedia.org/wiki/Hexspeak
- balls187 9y ago0xDEADBEEF how I miss you. Yea, I knew it was on purpose, but it had the unintended consequence of masking bugs that would only show up in release builds.
- insulanus 9y ago0xCD is the interrupt instruction on X86. If you tried to execute out-of-bounds memory, you get a trap right away (handily, the instruction is one byte long). http://www.mathemainzel.info/files/x86asmref.html#int http://www.mathemainzel.info/files/x86asmref.html#int Before Intel processors had execute protection, this was a good way to catch bugs in your buggy C bugs. I mean programs.
- balls187 9y agoIt was a "good" way to catch a certain class of bugs on X86, while introducing a different class of (arguably) harder to catch bugs. With VS .NET (VC7.0), the C++ compiler no longer defaulted uninitialized memory in debug builds. Our software didn't just run on x86 (windows/linux), but also SGI MIPS (Irix), VAX (VMS), DEC Alpha (Tru64), AND PowerPC (VxWorks), so across all those compilers, we ended up having portable and robust code.