D
dj3vande
D> In article <[email protected]>,
D> [Talking about javac, though the comments here apply just as
D> much to any other compiler]
D> The things a compiler does are helped immensely by code
D> generators for things like the tokenizer and the parser, but
D> the generated code (and the generators themselves!) can very
D> easily be entirely standard C, and it's not immediately obvious
D> how going beyond the standard for the rest of the compiler
D> would help either.
D> If there's no benefit for going outside what the standard
D> provides, wouldn't that be a reason to restrict it that far?
There may be no academic benefit (i.e., everything you might use
outside the standard can be reimplemented in standard C), but there's
a lot of possible practical benefit (i.e., using strsep or strtok_r,
for instance, or other BSD or POSIX standard calls).
Because nobody would ever want to run your compiler on a non-BSD,
non-POSIX platform like, say, Windows.
There's a tradeoff between portability and programmer convenience, and
it should not come as a great surprise to anyone in this newsgroup
that there are times when one opts for convenience over portability --
The examples you've given are terrible ones to use to illustrate this
point, since the cost of writing your own code to get that
functionality is not only a vanishingly small fraction of the total
cost of writing a compiler, but also highly unlikely to be larger than
the cost of going back after system-specific code has been written and
porting it to another hosted system (which, depending on how well the
design was done and how well the non-portable parts were separated out,
may or may not also be vanishingly small compared to the total cost of
building the whole thing in the first place).
dave