Ex Bibliotheca

The life and times of Zack Weinberg.

Thursday, 14 February 2002

# 7:20 PM

the best thing about standards is there are so many to choose from

Well, in this case, the best thing about standards is they often have completely brain dead mandated semantics. Take the humble #line directive. Its purpose is to let a programmer adjust the apparent file and line of the code being compiled. It takes a filename parameter. You would think that it would use the same syntax as the other directive that does that, #include. But no, the C standard mandates they have different syntax. Well, maybe. As is common with the C standard, the text can be interpreted multiple different ways; and if you ask the committee informally, two different members respond with contradictory answers, both with solid arguments.

Meantime, there's code out there that assumes that #line works like #include, and no one has shown me code that assumes that they don't. So I'm making GCC treat them the same way. It turns out that this requires major surgery; not because it's intrinsically hard to do, but because you'll never notice the difference unless you use filenames or #line directives containing nasty characters (like newline), and other bugs pop up if you do that. So I can't validate my fix without fixing all the other bugs as well.

(That is, on Unix you'll never notice the difference. On Windows, you definitely will, because Windows uses backslash (\) for its directory separator, and most C programs treat backslash as meaning "the next character in this string is special.")

# 12 AM

Emergency laundry is done. Now to take a shower and run off to the NTL meeting. I hope we're having edible food this week.