[Olsr-dev] using system-defined macros thruout, e.g. __linux__ and _WIN32

Hans-Christoph Steiner (spam-protected)
Tue Jul 31 17:25:59 CEST 2012


I propose to use the platform detection macros that are defined by the compiler/system headers rather than using ones defined in the Makefile (i.e. -Dlinux) throughout the olsrd code.  It makes the platform detection independent of the build system, it is good form and standard practice, it makes the code more readable, etc.  I've seen -DUNIX mean GNU/Linux and -Dlinux mean UNIX, so even using a name like 'linux' does not always mean what the word says.  This is almost already the case in the current code, it already uses __cplusplus, __GNUC__, __FreeBSD__, __FreeBSD_kernel__, __APPLE__, __NetBSD__, __OpenBSD__, and __ANDROID__.

I propose to:

- remove -Dlinux from all Makefiles and switch to __linux__
http://sourceforge.net/apps/mediawiki/predef/index.php?title=Operating_Systems#Linux

- change WIN32 to _WIN32 since its the one Microsoft recommends and is supported by all Windows compilers: http://msdn.microsoft.com/en-us/library/ff540443.aspx

I'll happily make these changes, or defer to anyone who wants to.

.hc



More information about the Olsr-dev mailing list