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 suggest putc/fputs over printf("string") or printf("\n")


> Date: Sun, 10 Jan 1999 02:18:40 -0500 (EST)
> From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
> To: egcs-patches@cygnus.com, egcs@cygnus.com

> Do people think that the warnings appearing below would be useful?

> cccp.c:1635: warning: suggest using `putc' instead of `fprintf'
> cccp.c:2058: warning: suggest using `fputs' instead of `fprintf'
> cccp.c:10232: warning: suggest using `strcpy' instead of `sprintf'

No, I don't like these at all.  I think it would be more useful to fix
the compiler to transform the printf call into a putc call, the hard
thing about it is you really want to do this early so that you can get
at the marcos, if any.  Anyway, even if one didn't, I think it would
still be useful.

The reasoning behind not liking these, is it unduly encourages people
to save five clock cycles at the expense of readable code.  If it goes
in, please don't have it on by default or -Wall.

Yes folk, this optimization is allowed, at least in C++.  :-)


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