On Mon, Feb 04, 2019 at 08:54:29AM +0100, Juergen Borleis wrote:
> On Sunday 03 February 2019 22:48:06 Ulrich Ölmann wrote:
> > Explicitely casting an "off_t" variable to "long long" and formatting it
> > via "%lld" or "%llx" respectively makes 32- as well as 64-bit compilers
> > happy (tested with gcc-8.2.1 and clang-7.0.1).
> 
> Könnte hier der Cast (intmax_t) und der Prefix 'j' vielleicht besser sein?
> 
> off_t blub;
> 
>  printf("Blub is: %jd\n", (intmax_t)blub);

Note: the j length modifier exists only since glibc 2.1. Don't know
about non-Linux (or alternative Linux) libc implementations. (Do we care
about those?). Just checked the OpenSolaris state, printf there knows
about 'j', but notes:

        If  the j  length modifier is used, 32-bit applications that
        were compiled using c89 on releases prior to Solaris 10 will
        experience undefined behavior

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
OSS-Tools mailing list
OSS-Tools@pengutronix.de

Reply via email to