Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: parsing the format string at compile time... Keywords: format printf parsing modula-2 Message-ID: <11262@smoke.BRL.MIL> Date: 12 Oct 89 01:42:58 GMT References: <705@nixbur.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <705@nixbur.UUCP> jobrien@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.