parsing the format string at compile time...
Henry Spencer
henry at utzoo.uucp
Thu Oct 12 03:11:07 AEST 1989
In article <6737 at hubcap.clemson.edu> drcook at hubcap.clemson.edu (david richard cook) writes:
>> printf call is a constant (which it is most of the time), the compiler
>> should be able to parse the string at compile time, and turn the printf
>> call into something like the series of Modula-2 calls...
>
> If C did allow this, it would not be C. The compiler knows
>nothing about any functions, including I/O...
This may be true of your compiler, but it is far from universal. The
C library is part of the language. It's been that way informally for
a long time (as witness the flak Whitesmiths took over their attempts
to rationalize the library) and is now official (ANSI C). Such an
optimization is perfectly legitimate. And no, it doesn't require a
#pragma to enable it.
--
A bit of tolerance is worth a | Henry Spencer at U of Toronto Zoology
megabyte of flaming. | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list