Solaris supports '%zd' and '%zu' format parameters also... Just to add to the confusion... :-)
Dan On 4/5/12 8:15 AM, Markus Grönlund wrote:
Staffan, Is this code only going to be built/executed on a Linux system (i.e. gcc compiled)? I guess so (since it says src/os/linux/) - I think %zd is a gcc specific extension right? (Visual C++ for instance uses %lu and %ld respectively where gcc has %zu and %zd) Is that a problem that we might be using C++ compilers not adhering to C99/or gcc extensions on other platforms (don't know if/how we cross-compile)? /Markus-----Original Message----- From: Staffan Larsen Sent: den 5 april 2012 14:25 To: serviceability-dev Subject: RFR(XXS): 7133111: libsaproc debug print should be printed as unsigned long to fit large numbers on 64bit platform Please review the following one-character fix to a printf format string. A 'z' is added to the printout of a size_t field. Thanks, /Staffan diff --git a/agent/src/os/linux/ps_core.c b/agent/src/os/linux/ps_core.c --- a/agent/src/os/linux/ps_core.c +++ b/agent/src/os/linux/ps_core.c @@ -440,7 +440,7 @@ int j = 0; print_debug("---- sorted virtual address map ----\n"); for (j = 0; j< ph->core->num_maps; j++) { - print_debug("base = 0x%lx\tsize = %d\n", ph->core-map_array[j]->vaddr,+ print_debug("base = 0x%lx\tsize = %zd\n", ph->core-map_array[j]->vaddr,ph->core->map_array[j]-memsz);} }
