From: Keith M. <kei...@us...> - 2013-08-18 09:32:16
|
On 18/08/13 07:16, Lostgallifreyan wrote: > About the %I64u mentioned in your other mail I discovered that having > tried printf("%s",PRIu64) after Keith Marshall wrote about PRIu64. I > could use it but I presume that it's unwise if on someone else's > machine that test prints %lu or something else... The whole point of PRIu64 is that it *portably* represents the *correct* format effector for a 64-bit unsigned integer value, *regardless* of the host compiler -- on Windows, "%"PRIu64 will be interpreted as "%I64u", on POSIX, with 32-bit long and 64-bit long long, it will become "%llu". There is a potential issue: the host may not have inttypes.h, but in that case the compiler will tell you, so you can resolve the issue. If you want portable code, PRIu64 is the *wise* choice, then handle the anomalous cases -- such as MSVC, perhaps -- as they arise. -- Regards, Keith. |