1.12 KB, patch
|Details | Diff | Splinter Review|
I wanted to log a PRTime using mozilla/Logging.h and thought that integerPrintfMacros.h would allow me to specify a portable format string, i.e. PRId64. But it didn't work and indeed "%ld" gave the same nonsense value. Only "%lld" worked as expected. After a while I realised this was by design, the logging functions use prlog.h and nspr defines its own set of printf-like functions with a different definition of format strings to that in C99, as noted in nsprpub/pr/include/prprf.h
Created attachment 8636717 [details] [diff] [review] Add note warning about incompatibility with NSPR printf-like functions
Comment on attachment 8636717 [details] [diff] [review] Add note warning about incompatibility with NSPR printf-like functions Review of attachment 8636717 [details] [diff] [review]: ----------------------------------------------------------------- r=me with the change below. ::: mfbt/IntegerPrintfMacros.h @@ +9,5 @@ > #ifndef mozilla_IntegerPrintfMacros_h_ > #define mozilla_IntegerPrintfMacros_h_ > > /* > + * Intended for use with libc's printf function family. Should not be used with I think it's a bit redundant to include the bit about libc. How about: "NB: These macros should not be used with the NSPR printf-like functions or their users, e.g. mozilla/Logging.h. If you need to use NSPR's facilities, see the comment on supported formats at the top of nsprpub/pr/include/prprf.h."
Attachment #8636717 - Flags: review?(nfroyd) → review+
Created attachment 8639380 [details] [diff] [review] Note incompatibility with NSPR printf-like functions.
Attachment #8636717 - Attachment is obsolete: true
No try run needed as it's a comment only change and I definitely haven't fat-fingered the keyboard.
Assignee: nobody → oliver.henshaw
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
status-firefox42: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.