This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Gcc 3.0, printf() and exim-3.30


Russ Allbery <rra@stanford.edu> writes:

|> (Out of curiosity, is that little aid to GCC as braindead as it looks?
|> I'd think that if GCC optimized fprintf, it would pick up printf too....)

'fprintf (foo, "bar")' can be replaced by 'fputs ("bar", foo)'.  But
'printf ("bar")' cannot be replaced by 'puts ("bar")' (the latter add a
newline).  It must be replaced by 'fputs ("bar", stdout)'.  But gcc does
not know how to synthesize 'stdout' at this level, it doesn't even have to
be declared, like in:

int printf (const char *, ...);
int main () { printf ("Hello World\n"); return 0; }

which is completely valid.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]