LPC 17XX

Peter Dufault dufault at hda.com
Fri Jan 17 00:43:34 UTC 2014


On Jan 16, 2014, at 12:50 , Joel Sherrill <Joel.Sherrill at oarcorp.com> wrote:

> 
> gcc optimizes calls to printf with fixed strings (e.g. no formatting 
> parameters)
> into calls to puts.
> 

In the absence of any header files, and with a declaration of what "printf()" is supposed to do, this code snippet, without any optimization enabled, and without including any header files, and with a declaration of what the external printf() function does, generates a call to puts() on gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4).

Are there C standards that makes this less surprising than it is to me?  Is "printf()" now a language feature?

int printf(const char *s, ...);

int main(int ac, char *av[])
{
    printf("Hello world!\n");
    return 0;
}


Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering





More information about the devel mailing list