Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!psuvax1!gatech!hubcap!drcook From: drcook@hubcap.clemson.edu (david richard cook) Newsgroups: comp.lang.c Subject: Re: parsing the format string at compile time... Message-ID: <6737@hubcap.clemson.edu> Date: 11 Oct 89 11:50:53 GMT References: <705@nixbur.UUCP> Distribution: usa Organization: Clemson University, Clemson, SC Lines: 17 From article <705@nixbur.UUCP>, by jobrien@nixbur.UUCP (John O'Brien): > 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? > > Enquiring Minds Want to Know! > If C did allow this, it would not be C. The compiler knows nothing about any functions, including I/O. Some new compilers may be able to this, though I do not know of any, by using the #pragma preprocesser directive to declare certain functions as builtin. The use of #pragma is left up to the compiler implementation and not C. If an ANSI C implementation does not understand what the #pragma directive is trying to accomplish, it will simply ignore it.