See globals.h where there are definitions for V8PRIxPTR, etc. Also, we probably shouldn't use %p since formatting is different on different platforms :\
Thanks! -- dean On Sat, Jun 13, 2009 at 1:39 AM, Ben Leslie<be...@benno.id.au> wrote: > > Hi all, > > In resurrecting nullos support for ARM I came across this code in > src/arm/disasm-arm.cc: > > fprintf(f, "%p %08x" %s\n", > prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); > > The problem with this is that '%x' is just for integers, but depending > on the compiler an int32_t > may be an 'int' or it may be a 'long'. If it is a long, (like my > compiler seems to want to make it), > then you need '%lx', not '%x' or else the compiler throws a warning. > > Two fixes: > > 1/ Simply cast to int, instead of int32_t: > > fprintf(f, "%p %08x" %s\n", > prev_pc, *reinterpret_cast<int*>(prev_pc), buffer.start()); > > 2/ Use the macros in inttypes.h: > > fprintf(f, "%p %08"PRIx32" %s\n", > prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); > > My preferred fix is probably #1, as the availability of inttypes.h on > different platforms is a little sketchy. > > I'd appreciate any guidance on the group's preferred approach. > > Thanks, > > Benno > > > > --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---