Zzzz

08 Jul

mystery bug

Compiling someone else’s source code, there was one part in the program that mysteriously didn’t work like it was supposed to. During debugging, it became obvious that the program is simply ignoring an entire case statement.

The cause?

Japanese comments in the code.
// 無機能
case 0:

in S-JIS encoding, ends in a backslash character, making a multiline comment which screwed up the case label and the rest of that function.

Moral: do not ignore GCC’s “warning: multi-line comment”.

Edit: lol, this actually has a name: 0x5c問題 (0x5c problem). After the ascii code for backslash.

One Response to “mystery bug”

  1. 1
    PeterM Says:

    Thanks for that tip. I’ll keep an eye out for it.

© 2024 Zzzz | Entries (RSS) and Comments (RSS)

wordpress logo