Comment 5 for bug 1740426

Revision history for this message
Martin Konrad (info-martin-konrad) wrote :

> Because of the promotion rules these should use the unmodified printf()
> format specifiers %d/i/o/u/x except for the 64-bit types which need the
> %ll modifier, even when building for Windows.
Rather than making assumptions about the mapping to platform-dependent types we should leave these things up to the standard library. Also technically long long is part of C99/C++11.

> #ifndef EPRIuSIZE
> # if defined(vxWorks)
> # define EPRIuSIZE "lu"
> # else
> # define EPRIuSIZE "zu"
> # endif
> #endif
Can we safely assume that pre-C99/C++11 compilers are only used for VxWorks? To be safe, I would suggest to start using %zu with EPICS 7.1. If we do so no EPICS-specific macro is required.

Using %zu as well as the format-string macros for fixed-size integer types defined by inttypes.h seems consequent and the most portable solution to me (with EPICS 7.1). Should a new format specifier make it into the C/C++ standard we can safely replace the ugly macros.

All this is probably affecting support modules more than Base since fixed-size integer types and printf aren't used that heavily in Base.