On Mit, 2008-06-18 at 16:14 +0530, ershaad ahamed wrote: > A quick google got me this > http://www.ciselant.de/projects/gcc_printf/gcc_printf.html > > seems its a feature of gcc. In certain circumstances it optimizes the > printf call to a puts call. While printf behaves nicely and prints s/printf/printf of the glibc/ There are other libc out there which simply seg-fault on that (and validly and with good reason). So personally I consider it a bug in the software it the code tries to e.g. printf()/sprintf()/... a NULL pointer. In short: Don't do it if you want to be on the safe side. > '(null)' when you pass it a null pointer, puts doesnt do that. From > the document above when "%s\n" is found in the format string it is > optimized to a puts call. Its interesting to note that the > optimization is disabled if the printf return value is assigned. So The semantics of the return values of the two functions is different as can be read in the manual page. Bernd -- Firmix Software GmbH http://www.firmix.at/ mobil: +43 664 4416156 fax: +43 1 7890849-55 Embedded Linux Development and Services -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ