app programming on freebsd amd64

Dieter freebsd at sopwith.solgatos.com
Fri Aug 1 22:10:50 UTC 2008


> I spent some enjoyable
> hours last night working out the 64 bit problems with my project, I have a fair
> chance of working it all out later on today (I hope).  Thanks for the help.

Assuming this is in C, the main things are to use function prototypes
(turn on the compiler warnings and fix anything it whines about),
and remember that on 32 bit int, long and pointer are all 32 bit (ILP32)
while on 64 bit ints remain 32 bit, long and pointer are 64 bit (LP64).
If you're porting someone else's code, they might assume that an int
can hold a long or pointer.  The compiler can catch most of the stuff
that causes problems, if people would bother to fix the stuff it warns
about.

This isn't rocket science, yet there is a lot of code out there that
assumes all the world is ILP32.  Not just code from 25 years ago,
but recent code as well.  Don't they teach portability in school?


More information about the freebsd-amd64 mailing list