[Toybox] [PATCH] fix compiler error

enh enh at google.com
Thu Aug 24 07:32:19 PDT 2023


On Thu, Aug 24, 2023 at 2:08 AM Rob Landley <rob at landley.net> wrote:
>
> On 8/23/23 11:35, enh via Toybox wrote:
> > %t is the appropriate choice for pointer differences on both ILP32 and
> > LP64, and shorter than casting to long:
> > ```
> > external/toybox/toys/pending/expr.c:209:45: error: format specifies
> > type 'long' but the argument has type 'int' [-Werror,-Wformat]
>
> Warning: long and int are literally identical in this context, and in the
> context where they're not long is correct.

as unix people you and i (and posix) believe that, but the c standard
doesn't require that. (maybe in another 40 years? we did eventually
get 8-bit bytes and two's complement...)

> Did we ever figure out what the standards committee was smoking?

ptrdiff_t seems like an unfortunate natural consequence of uintptr_t?
(the one i've never understood is intptr_t --- it's the more natural
name, but i only ever see it when i'm rooting out obscure bugs and
changing it to the uintptr_t that should have been used instead! i
assume intptr_t is an unfortunate natural consequence of all other
integral types having signed and unsigned variants?)

> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net


More information about the Toybox mailing list