Re:When you see a Heisenbug in C, change your compiler's opt...
by cnvogel on Sunday March 02, 2014 @04:46AM
(#7328484)
I had a similar story I'd like to share. A colleague had written out the initialization data for some embedded component, and helpfully included the ASCII representation for some of the (mixed) binary/readable stuff we sent. So he wrote something along the lines of...
unsigned char initdata[] = {
0x01, // some value, e.g. 513
0x02, // as 16bit, little endian
0x40, // ASCII @
0x5c, // ASCII \
0x42, // ASCII *
0x09, // number 9
(...)
};
Re:When you see a Heisenbug in C, change your compiler's opt...
by mansr on Sunday March 02, 2014 @06:45AM
(#7328779)
C99 explicitly does \-splicing of lines before comment processing:
//\
this is a comment
/\
/ this is also a comment
GCC has an option (-Wcomment, enabled by -Wall) to warn about this and other likely mistakes involving comments (e.g. nested /* */ comments).
As for heisenbugs specifically, I agree with you. I just wanted to tell a story. :)