On Wed, 30 Dec 2009 22:25:17 +0100 Joerg Sonnenberger <jo...@britannica.bec.de> wrote:
> On Wed, Dec 30, 2009 at 10:44:23AM -0200, Gustavo Sverzut Barbieri > wrote: > > > Unfortunately there is no safe way of printing it in C89 (ie > > > windows). The best way is: > > > printf("... %ld..",(unsigned int)blah); > > %ld and unsigned int? You must be joking... Defining PRIdMAX and > friends can be easily automated. I noted that I got it wrong in my follow up post - unsigned long is the correct cast (Sent almost 12 hours before your email). > > > Given that in many places we use those for logging and logging > > should move to EINA_LOG and some systems do not handle "%s" with > > NULL (ie: Solaris, BSDs...), isn't it better to follow > > Glib/Gstreamer logging and provide our own printf() on these > > systems, doing clean C99 with GNU niceness (%s+NULL) and avoid ugly > > thing spread in code? > > IMO it is still better to fix the programs. Besides, printf with NULL > is checked for on many systems (like the BSDs), the real problem is > that GCC sometimes decides to replace printf with fputs, which > doesn't... GCC only does the printf->puts replacement if the first arg if at compile time it can be sure that: - fmt does not contain any %'s - And printf has no extra arguments. The printf->puts replacement is this only an issue if you are doing: printf(NULL); In which case I'd argue there is something wrong with your code anyway. The issue which gustavo correctly raised is the problem of printf("...%s...",NULL); Which will never trip a puts replacement. Regards, nash ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel