1) Wrap any OS dependent call in a function, and put all these functions in one or more files separated from the non-OS-dependent code
In these files use the OS macros to switch functionality depending on where the program is compiled
2) Use strictly standard C++, avoid any compiler specific extension
3) Beware that the ranges of built-in types may vary depending on compiler and machine