On Jan 16, 2014, at 12:50 , Joel Sherrill <joel.sherr...@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


_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to