patch to suggest putc/fputs over printf("string") or printf("\n")

Arvind Sankar arvinds@mit.edu
Mon Jan 11 11:56:00 GMT 1999


On Mon, Jan 11, 1999 at 11:43:32AM -0800, Mike Stump wrote:
> > 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.

I don't get this. How are putc, fputs, strcpy any _less_ readable than
their printf equivalents?

-- arvind



More information about the Gcc-patches mailing list