Porting C Code
Problems in Porting C Code
This is by no means a comprehensive guide more of a notes to self when trying to write portable C code.
Not that this covers much in the way of a wide variety of operating systems and architectures. These are the problems you face when writing for regular 2015-ish x86 *nix systems. No Windows, no SPARC or MIPS. Not even much variety in the way of compilers. gcc is almost omnipresent though Clang is making some room for itself.
Operating Systems
In no particular order, uname -srpm is used to identify systems
OS | Release | Bits | uname -s | uname -r [1] | uname -p | uname -m |
---|---|---|---|---|---|---|
CentOS | 7 | 64 | Linux | 3.10.0-229.7.2.el7.x86_64 | x86_64 | x86_64 |
CentOS | 6 | 32 | Linux | 2.6.32-504.23.4.el6.i686 | i686 | i686 |
OpenIndiana | 151a8 | 64 | SunOS | 5.11 | i386 | i86pc |
OpenIndiana | 151a8 | 32 | SunOS | 5.11 | i386 | i86pc |
OS X | Yosemite | 64 | Darwin | 14.4.0 | i386 | x86_64 |
OS X | Leopard | 32 | Darwin | 9.8.0 | i386 | i386 |
Ubuntu | LTS | 64 | Linux | 3.13.0-24-generic | x86_64 | x86_64 |
Debian | 8 | 64 | Linux | 3.16.0-4-amd64 | unknown | x86_64 |
Debian | 8 | 32 | Linux | 3.16.0-4-686-pae | unknown | i686 |
FreeBSD | 10 | 64 | FreeBSD | 10.0-RELEASE | amd64 | amd64 |
[1] | uname -r should be taken with a pinch of periodic OS upgrade in mind. The values were good at time of writing. |
Document Actions