This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch to suggest putc/fputs over printf("string") or printf("\n")
- To: law at cygnus dot com, "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: patch to suggest putc/fputs over printf("string") or printf("\n")
- From: Jamie Lokier <egcs at tantalophile dot demon dot co dot uk>
- Date: Sat, 16 Jan 1999 00:51:07 +0000
- Cc: egcs-patches at cygnus dot com, egcs at cygnus dot com
- References: <199901100718.CAA06898@caip.rutgers.edu> <16967.915956265@hurl.cygnus.com>
On Sun, Jan 10, 1999 at 01:17:45AM -0700, Jeffrey A Law wrote:
> Actually, I'd consider a patch which conditionally converted them for the
> user. We've kicked that idea around quite a bit inside Cygnus, but never
> got excited enough to implement it. See also:
>
> http://www.nullstone.com/htmls/category/printf.htm
Bear in mind, that most of these optimisations (if not all) tend to make
programs larger. So they aren't always desirable.
- putc is almost always larger than printf, though much faster.
- puts requires separate library code, when just printf would have done.
Often, the calling sequence is the same for both.
- Splitting printf("foo %s", str) into two function calls will almost always
result in larger code.
-- Jamie