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

Hans-Christoph Steiner (spam-protected)
Mon Aug 27 21:33:54 CEST 2012


Ok, I just pushed these to master.

This site is a nice reference for this kind of thing:
https://sourceforge.net/p/predef/wiki/OperatingSystems/

.hc

On 08/02/2012 11:48 AM, Hans-Christoph Steiner wrote:
> 
> Any other comments or objections?  If not, I'll go ahead and do this.
> 
> .hc
> 
> On 07/31/2012 06:34 PM, Henning Rogge wrote:
>> I would be okay with this changes to get the code more consistent
>> (both itself and with other code). The makefile macros were defined
>> years and years ago and were just kept around.
>>
>> Henning
>>
>> On Tue, Jul 31, 2012 at 8:25 AM, Hans-Christoph Steiner
>> <(spam-protected)> wrote:
>>>
>>> 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
>>> --
>>> Olsr-dev mailing list
>>> (spam-protected)
>>> https://lists.olsr.org/mailman/listinfo/olsr-dev
>>
>>
>>




More information about the Olsr-dev mailing list