Who’d have thought:
- that DOS backslashes in C include paths aren’t only ugly and a pain, but also not legal* C:
If the characters ‚, \, „, //, or/* occur in the sequence between the < and > delimiters, the behavior is undeï¬ned. Similarly, if the characters ‚, \, //, or /* occur in the sequence between the “ delimiters, the behavior is undeï¬ned. A header name preprocessing token is recognized only within a #include preprocessing directive.
(C99 6.4.7.3)
- … the C99 Standard is available for free online This links directly to the pdf containing the current standard, which lives here.
-
It’s easy to fix:
find . -name '*.[c|h]' -print0 | xargs -0 \ ruby -i.bak -pe 'scan(/^\s*#include.*/){ gsub(/\\/, "/") }'
* yeah, I know, it’s legal just undefined.
** this post inspired by this.