[erlang-patches] Re: Two printf format fixes
Mikael Pettersson
mikpe@REDACTED
Tue Mar 2 14:31:34 CET 2010
Martti Kuparinen writes:
> Björn Gustavsson wrote:
>
> >> - fprintf(stderr, "esock_malloc: cannot alloc %d bytes\n", size);
> >> + fprintf(stderr, "esock_malloc: cannot alloc %zu bytes\n", size);
> >
> > As far as I know, the "z" specifier is not portable. For
>
> Could you then consider type-casting size to (unsigned long long) and use the
> correct format for that?
You're underestimating the brokenness of MS' so-called C compiler and its lame libc.
They support neither %z nor %ll, so replacing %z with something else just creates
another porting issue. (At least they didn't last time I checked, which probably
was with VS2005 or VS2008.)
I've found it necessary to provide my own PRIuSZ macro and define it as "I64u"
on (MS && x86_64) and as "zu" elsewhere. I don't recall what MS && i386 needed,
possibly just "u" or "lu".
More information about the erlang-patches
mailing list