why using asUnsignedLong in writeScavengeLog

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

why using asUnsignedLong in writeScavengeLog

Nicolas Cellier
 
Hi Eliot,
I wonder why to print (manager statSGCDeltaUsecs asUnsignedLong) rather than just (manager statSGCDeltaUsecs) in SpurGenerationScavenger>>writeScavengeLog.

The compiler barks:
Avertissement    C4477    'fprintf' : la chaîne de format '%lld' nécessite un argument de type '__int64', mais l'argument variadique 5 est de type 'unsigned long'    SqueakCogSpur    X:\Smalltalk\opensmalltalk-vm\spur64src\vm\cointerp.c    43531   

The former indeed truncates 64bits sqInt to 32 bit unsigned int but the format PRIdSQINT expects a 64bits signed int... Doesn't the variadic implementation stacks/unstacks the arguments, and isn't passing a longer or a shorter type potentially problematic?

The later would just do the right thing in 64 bits, and I think in 32 bits too. Or do I miss something? What was the intention?