Alexandre Julliard : crypt32/tests: Avoid sizeof in traces.

Dan Kegel dank at kegel.com
Fri Aug 25 16:18:49 CDT 2006


On 8/25/06, Alexandre Julliard <julliard at winehq.org> wrote:
> > Just so I know, what is the warning? Does sizeof() return
> > a 64-bit integer on those platforms?
>
> Not on 32-bit platforms, but it's defined as long instead of int so we
> still get a printf format warning.

The incredibly ugly solution I've used in the past is

// printf macros for size_t, in the style of inttypes.h
#ifdef _LP64
#define __PRIS_PREFIX "z"
#else
#define __PRIS_PREFIX
#endif
#define PRIuS __PRIS_PREFIX "u"

and then
  printf("size is %" PRIuS "\n", sizeof(foo));

Much nicer just to avoid using size_t in printf's if you can.
- Dan



More information about the wine-devel mailing list