Re: Alexandre Julliard : crypt32/tests: Avoid sizeof in traces.
On Fri, August 25, 2006 2:34 pm, Alexandre Julliard wrote:
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Aug 25 18:37:38 2006 +0200
crypt32/tests: Avoid sizeof in traces.
This is non-obvious -- why is that? -- Dimi Paun <dimi(a)lattica.com> Lattica, Inc.
"Dimi Paun" <dimi(a)lattica.com> writes:
crypt32/tests: Avoid sizeof in traces.
This is non-obvious -- why is that?
It's causing warnings on some platforms, like MacOS. Actually there was a big cleanup some time ago, this one just crept back in since then. -- Alexandre Julliard julliard(a)winehq.org
On Fri, August 25, 2006 2:55 pm, Alexandre Julliard wrote:
It's causing warnings on some platforms, like MacOS.
Just so I know, what is the warning? Does sizeof() return a 64-bit integer on those platforms? -- Dimi Paun <dimi(a)lattica.com> Lattica, Inc.
"Dimi Paun" <dimi(a)lattica.com> writes:
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. -- Alexandre Julliard julliard(a)winehq.org
On 8/25/06, Alexandre Julliard <julliard(a)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
On Fri, Aug 25, 2006 at 02:18:49PM -0700, Dan Kegel wrote:
On 8/25/06, Alexandre Julliard <julliard(a)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.
That doesn't help for the case: char xxx[...] ... printf("%.*s", sizeof xxx, xxx); since the argument for '*' has to be of type 'int'. Here you have to have the (int) cast, directly of maybe via: #define isizeof (void)sizeof David -- David Laight: david(a)l8s.co.uk
participants (4)
-
Alexandre Julliard -
Dan Kegel -
David Laight -
Dimi Paun