bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about portability guidelines


From: Ben Pfaff
Subject: Re: Question about portability guidelines
Date: Tue, 3 Jan 2017 16:16:08 -0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Jan 02, 2017 at 04:09:59PM -0800, Paul Eggert wrote:
> Bruno Haible wrote:
> >I would vote for removing this sentence "Gnulib code can assume that standard
> >internal types like size_t are no wider than long." The fix is easy nowadays
> >(since MSVC now has <stdint.h>): Use intptr_t or ptrdiff_t or size_t as
> >appropriate.
> 
> It's not that easy for code that wants to print such integers, as %ld
> doesn't suffice on MinGW and older POSIXish libraries don't support %jd etc.
> Perhaps once Gnulib assumes C99-or-later libraries, and once somebody goes
> through all the Gnulib code and checks it. In the meantime we should
> probably leave something like that sentence in there, although we should
> warn people about the MSVC issues. I installed the attached to try to do
> that, and to try to clarify the issues about C89 vs C99 vs C11 that were in
> Paul's question.

One strategy is to use PRIdPTR for ptrdiff_t and PRIdMAX or PRIuMAX
(plus a cast) for other types.

In one project of mine (which does not use Gnulib) I introduced a
PRIuSIZE macro.  This is not a standard macro, but I don't understand
why not.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]