Porting to Intel

An IP address is not a long int – it’s 4 bytes. Doing something like this is bad:

sprintf(buf,”%ld.%ld.%ld.%ld”, (ip>>24) & 255, (ip>>16) & 255, (ip>> 8 ) & 255, ip & 255);

Mac x86 porting

Although I don’t have the x86 development system, I’ve been using XCode 2.1. For one of my projects, I was able to convert to x86 in less than 15 minutes. I simply opened the project in XCode 2.1, selected the 10.4 universal SDK, chose intel & ppc architectures, and made sure it was using GCC 4.0. I got lots of errors because GCC 4.0 is a lot more fussy about pointer conversions, so I temporarily eliminated them with the option “Treat nonconformant code errors as warnings”.

It compiled and when I examine the binary, it’s identified as ‘Mach-O fat file with 2 architectures’. Of course I can’t actually test it on an x86 machine. I also haven’t attempted to deal with any endian issues, since the application deals with binary data.

This is a pretty good indication that developing for the Intel macs will be painless.