[Vm-dev] why using asUnsignedLong in writeScavengeLog

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Dec 25 22:06:25 UTC 2018


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20181225/ee3775bc/attachment.html>


More information about the Vm-dev mailing list