This is the mail archive of the gcc-patches@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: Patch to add __builtin_printf


On Tue, 19 Sep 2000, Kaveh R. Ghazi wrote:

:  >   char *foo;  printf (foo);  -> printf ("%s", foo);  [->fputs (foo, stdout)]

: I'm about to submit patches to achieve: printf("%s",foo)->fputs(foo,stdout)
: (Capturing stdout was the hairy part.)

I presume it's hairy because "stdout" is a CPP macro on many operating
systems?  8^)

: Anyway, whether to automatically do the transformation you suggest on
: printf(foo) is debatable IMHO given that the original is a legal (but
: admittedly dangerous) use, and the transformation by nature isn't
: equivalent.  (E.g. "%%" gets printf-processed in the original style.)

I believe a warning, not a transform, is appropriate in that case.  ("Leave
the transform to the programmer" if it's not exactly equivalent on output.)

-- 
-- Todd Vierling (tv@pobox.com)


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