[Novalug] 64bit vs 32bit

John Franklin franklin at elfie.org
Mon Apr 14 11:46:31 EDT 2008


On Mon, Apr 14, 2008 at 05:11:27AM -0400, Ed James wrote:
> All,
> 
> If I install from source and compile apps written in the 32-bit
> era (like I'm doing when I write my own stuff), will the apps
> automagically always compile okay into 64-bit apps, or are there
> "gotcha"s that bite when such a re-compile is done?

There are gotchas. Most of them stem from the sizes of base types.  

	32-bit	64-bit
short	2	2
int	4	4
long	4	8
void*	4	8

If you compile something that's not 64-bit clean, you'll probably get a
lot of "integer to pointer conversion" warnings.  That's because the
code is trying to save an 8-byte void* in a 4-byte integer. 

If longs or pointers are used in structures, the size of the structure
will change, so may the padding.  If these structures are being written
directly to or from disk or sockets, obviously the 32-bit and 64-bit
code won't agree.

This was a problem about ten years ago when the only 64-bit systems
commonly available were SPARC and Alpha systems.  Since the first 64-bit
AMD and Intel chips came out over five years ago, a lot of effort has
been put into cleaning up code.  At this point, most projects in the
wild are 64-bit clean.

Funny story, they had Gordon Moore (of Moore's Law fame) on CNBC back in
2002 asking him, "How important is it for Intel to win the 64-bit race?"
I looked over on my kitchen table at an 8 year old Alpha workstation and
thought, "The race is over.  You missed it."

jf
-- 
John Franklin
franklin at elfie.org
ICBM: N37 12'54", W80 27'14" Z+2100'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://calypso.tux.org/pipermail/novalug/attachments/20080414/05d5ae3b/attachment.pgp


More information about the Novalug mailing list