Is there a HOST_BITS_PER_POINTER macro?
Joern Rennecke
amylaar@cygnus.co.uk
Thu Feb 5 22:09:00 GMT 1998
> If I have the following in gcc's src code:
>
> char * foo;
> [...]
> printf(HOST_PTR_PRINTF, foo);
>
> I get a warning from "-W -Wall" which complains about int format vs
> pointer argument. Is there a way to define a macro in machmode.h
> which can cast the pointer to the appropriately sized integer type?
> I'd like to do the following
Even if you had something like that (e.g. ptrdiff_t on systems that
have it), that would be little help: You'd have to make sure that the
integer type matches the format specifier.
I think the most portable you can get without autoconf help is to
use long consistently, i.e. cast to long and use a long format specifier.
Of course that will still fail when pointers are wider than long...
More information about the Gcc
mailing list