[gameprogrammer] Re: SDL atomic operations part #2, and many thanks to the QNX maintainer.

Bob Pendleton wrote:

Having looked at what the other guys do I rather like providing separate ops for ints and pointers. BUT, that would mean casting pointers to signed ints on some platforms. Casting pointers to signed ints makes me very very nervous. I spent too much of my youth working on machines where int and (void *) were not the same size.

I think we're back in that territory with Intel's and AMD's 64-bit systems: I'm pretty sure modern Linux distributions on modern x86-64 machines operate in 64-bit mode normally, I think the upcoming release of OS X is 64-bit by default, and Windows has had a 64-bit version (that isn't a redheaded step-child like XP-x64) for a few years now. In fact, since at least Visual Studio 2005, Microsoft has included warning/error options for potentially 64-bit-unsafe operations.

The other thing is also a casting question. How do you feel about casting signed to unsigned, doing doing addition or subtraction, and then casting it back? Or, the reverse. We have the problem that some of the platforms provide ops for only signed ints and some for only unsigned ints.

That's gross, but it's not nearly as bad as treating pointers and integers as the same size, IMO.
--
 Matthew Weigel
 hacker
 unique & idempot . ent

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: