John Bode wrote, On 04/12/08 16:55:
> On Dec 4, 10:04 am, Tomás Ó hÉilidhe <t...@lavabit.com> wrote:
>> I would like to draw up a finite list of things you have to "watch out
>> for" when compiling a C program for a different kind of CPU than it
>> was originally intended for. For instance, let's say you have a C
>> program that was intended to run on an x86 processor, but you want to
>> run it on an Apple Mac that has a PowerPC processor.
>>
>> Well the obvious ones are:
>
> Byte sex (endianess)
> Alignment restrictions
> Type sizes
With floating point there is a lot more than just the type size!
CHAR_BIT (and everything else in limits.h)
Division of negative values
Timings (if they matter)
Extensions (ones used by the SW you are porting)
Availability of a compiler for the version of the C standard the code
conforms to (especially if it is C99 code)
Legal paths/filenames
Limits on program/data sizes
Whether it uses text/binary streams correctly
Anything the standard says in implementation defined
Use of anything the standard leave as unspecified or undefined
It goes on and on if you are talking about some random program. Writing
a program to be portable in the first place can be rather easier.
--
Flash Gordon
If spamming me sent it to
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at
http://clc-wiki.net/