[OSGeo-Discuss] FOSS4G on Windows

Mateusz Loskot mateusz at loskot.net
Thu Aug 6 19:06:02 EDT 2009


Paul Ramsey wrote:
> It's not a matter of "like" or "not like" it's a matter of "hassle" 
> or "no hassle". I work on OS/X and Linux, and compiling there is 
> radically different than compiling on Windows. And while OS/X and 
> Linux and Solaris have slight system API differences which require a
>  little working around, Windows can have quite large differences.

(I'll stick to C/C++)

In generally and nowadays, it's really not that hard to keep software
like OSGeo C/C++ stack portable across Unix and Windows.
However, the problem may be that there are projects that like or need to
support not only various systems but also generations of implementations
of C and C++. What for? I have no idea, but they do so.

Here is my list of principles of portability in C/C++:

0. Obey the standards, because they are not just dumb rules.

1. Make a list of compilers that must be supported. Check differences.

2. If possible, use GCC 4+ and Visual C++ 7.1+

3. Using old compilers? If possible, use C89 but avoid C99.

4. Prefer GCC 4.3.x 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.

5. Do not use POSIX.

6. Never ever disable any warnings compiler throw. Fix them.

7. Be pedantic. Compile in highest strict mode possible.

8. If possible, do not use compiler-specific features.

9. Do not make platform/architecture specific assumptions
about memory addressing, memory layout, etc.

10. Personal preferences are evil. Make decisions based on reasoning.

11. (Re)Use good code that already exist. Boost C++ Libraries won't
bite you!

12. KIMS (Keep it modular, stupid) and let modules to loose coupling in
in architecture, design as well as in development cycle (releases,
inter-modular dependencies)

Best regards,
-- 
Mateusoz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org


More information about the Discuss mailing list