Number of OSGeo stack software written by C/C++ camp have to run on Microsoft Windows systems. I think I wouldn’t be dead wrong if said that most of hackers from OSGeo Community work on Unix systems (Linux, Mac OS X) but there is large number of users who work on Windows.
Conclusion? Portability. Google is bursting at the seams of the essays about how to write portable code in C or C++ language. I’d add a little poem to the collection.
Principles of Portability
- Obey the standards, because they are not just dumb rules.
- Make a list of compilers that must be supported. Learn about their differences.
- If possible, use GCC 4+ and Visual C++ 7.1+.
- Using old compilers? If possible, use C89 but avoid C99.
- Prefer GCC 4.3 and Visual C++ 8.0+, so you get C++0x support. C++0x “brings C++ more in line with the C99” - Wikipedia, so portability is much easier.
- Write code in C or in C++, but do not write both at the same time.
- Avoid (direct) use of C POSIX Library.
- Never ever disable any warnings compiler throw. Fix them.
- Be pedantic. Compile in highest strict mode possible.
- If possible, do not use compiler-specific features.
- Do not make platform/architecture specific assumptions about memory addressing, memory layout, etc.
- First understand why, then cast the hack.
- Personal preferences are evil. Make decisions based on reasoning.
- (Re)Use good code that already exist. Boost C++ Libraries won’t bite you!
- KIMS (Keep it modular, stupid) and let modules to loose coupling but keep cohesion in architecture, design as well as in development cycle (releases, inter-modular dependencies).