parsing the format string at compile time...

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Oct 12 11:42:58 AEST 1989


In article <705 at nixbur.UUCP> jobrien at nixbur.UUCP (John O'Brien) writes:
-It seems to me that if the format string in the 
-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, with a correspond-
-ing increase in efficiency.  Do C compilers do this?  Are there any prob-
-lems with doing this?

The proposed C Standard permits this in a conforming hosted implementation.
I don't know of any existing implementations that do this, although some do
optimize other standard library functions into in-line code.



More information about the Comp.lang.c mailing list