Should _GNU_SOURCE be defined always?

Carlo Wood carlo@alinoe.com
Sun Feb 17 06:22:00 GMT 2002


The following program:

---
#define _GNU_SOURCE
---

Gives different results with different compilers:

>g++-2.95.3 -c test.cc -o test.o
>g++-3.0 -c test.cc -o test.o
>g++-3.0.1 -c test.cc -o test.o
>g++-3.0.2 -c test.cc -o test.o
>g++-3.0.3 -c test.cc -o test.o
test.cc:1:1: warning: "_GNU_SOURCE" redefined
<command line>:1:1: warning: this is the location of the previous definition
>g++--3.0.4 -c test.cc -o test.o
test.cc:1:1: warning: "_GNU_SOURCE" redefined
<command line>:1:1: warning: this is the location of the previous definition

In other words, as of 3.0.3 _GNU_SOURCE is suddenly already
defined by the compiler.

Can I count on it that it will stay defined in all future versions?

-- 
Carlo Wood <carlo@alinoe.com>



More information about the Gcc mailing list