[Scummvm-devel] Re: [Scummvm-cvs-logs] SF.net SVN: scummvm: [21824] scummvm/trunk/engines/sky

Jonathan Gray jsg at goblin.cx
Wed Apr 12 04:34:06 CEST 2006


On Wed, Apr 12, 2006 at 01:04:49PM +0200, Max Horn wrote:
> 
> Am 12.04.2006 um 12:01 schrieb khalek at users.sourceforge.net:
> 
> >Revision: 21824
> >Author:   khalek
> >Date:     2006-04-12 03:01:41 -0700 (Wed, 12 Apr 2006)
> >ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21824&view=rev
> >
> >Log Message:
> >-----------
> >sizeof(void *) != sizeof(int) for a large number of systems.
> >Fix a lot of debug/error statements that were using %d/%x
> >for the result of pointer arithmetic.
> >
> >As C++ apparently has no format string for ptrdiff_t use
> >%lu/%lx as appropriate.
> 
> 
> Unfortunately, that change isn't correct either. While maybe now you  
> are warning free on a 64bit system, now I get lots of warnings on my  
> 32bit system, because *here* pointer diffs are not long int, but  
> rather int.
> 
> Neither C nor C++ define a printf extension for handling pointer  
> diffs. The only way we can deal with them "portably enough" would be  
> to explicitly case the diffs to int or long. In most cases, int  
> should be sufficient, since we know that the correct diffs will be  
> small, even on a 64bit system. Though we can also use long, I don't  
> mind which one is used.
> 
> As it is, I can't compile ScummVM with -Werror anymore. :-(

My preference is for casts to be done to long then in that case,
as it leaves less chance for error.

As mentioned ptrdiff_t is long on my 32bit machine here also.

It would be easier if someone who has a non long ptrdiff_t system
do the casts rather than me reverting my change and updating it.




More information about the Scummvm-devel mailing list