This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: patch to suggest putc/fputs over printf("string") or printf("\n")
- To: egcs-patches at cygnus dot com, egcs at cygnus dot com
- Subject: Re: patch to suggest putc/fputs over printf("string") or printf("\n")
- From: Arvind Sankar <arvinds at mit dot edu>
- Date: Mon, 11 Jan 1999 14:51:31 -0500
- References: <199901111943.LAA00852@kankakee.wrs.com>
- Reply-To: Arvind Sankar <arvinds at mit dot edu>
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