Article View: gnu.gcc.help
Article #52327Re: typedef for stack_t not included, why?
From: Chris Flatters
Date: Thu, 03 Dec 1992 20:27
Date: Thu, 03 Dec 1992 20:27
46 lines
3028 bytes
3028 bytes
In article 181@steiny.com, steiny@steiny.com (Don Steiny) writes: >I have been having a few problems with gcc (bit of bad luck on my part, >by some strange coincidence it will not compile any non-trivial program >I try :-(). > >The first problem is that it does not seem to find the definition for >stack_t in signal.h. According to the #if I need to have > >#if !defined (__STRICT_ANSI__) && !defined(_POSIX_SOURCE) > >before the code in the gcc-include/signal.h is included. But why would >_POSIX_SOURCE be undefined? Because you haven't defined it: _POSIX_SOURCE is a feature test macro. In a strictly conforming ANSI C environment the standard headers (those listed in section 7 of the standard) should not define any symbols or prototypes that are not defined in the standard. Historically, UNIX implementations have defined symbols and prototypes in these headers that are not defined in ANSI standard C. Feature test macros are used to keep UNIX interfaces consistent with ANSI C. If you want symbols and prototypes to be imported from that standard headers that are not part of the ANSI C standard you must define an appropriate feature test macro. This way you know that if you do not define a feature test macro your program is using only ANSI C facilities (provided it compiles of course). _POSIX_SOURCE is the feature test macro for the facilities in the POSIX.1 standard. If _POSIX_SOURCE is defined your program will import the ANSI C facilities and the POSIX.1 facilities but nothing else. POSIX.2 introduced the alternative macro _POSIX_C_SOURCE. If _POSIX_C_SOURCE is defined to be 1 you get ANSI C and POSIX.1 facilities (the same as defining _POSIX_SOURCE); if POSIX_C_SOURCE is 2 you get the POSIX.2 facilities as well. Other UNIX standards have their own feature test macros to activate features that are not ANSI C or POSIX. For example you can define _AES_SOURCE on an OSF/1 system to activate all of the features in the OSF AES or define _XOPEN_SOURCE on an XPG3 compliant system to activate features in XPG3. Now stack_t is not an ANSI C type nor is it a POSIX.1 type so you should not be able to import it into a strictly conforming program, even if _POSIX_SOURCE is defined. If you need stack_t you either need to find a magic feature test macro that enables its definition or turn off strict ANSI checking. Chris Flatters cflatter@nrao.edu
Technical Details
Message-ID:
<1992Dec3.202722.7217@nrao.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!uvaarpa!cv3.cv.nrao.edu!laphroaig!cflatterReferences:
<181@steiny.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,66f324bc1e7e9b33 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-12-03 12:51:52 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!uvaarpa!cv3.cv.nrao.edu!laphroaig!cflatter From: cflatter@nrao.edu (Chris Flatters) Subject: Re: typedef for stack_t not included, why? Message-ID: <1992Dec3.202722.7217@nrao.edu> Sender: news@nrao.edu Reply-To: cflatter@nrao.edu Organization: NRAO References: <181@steiny.com> Date: Thu, 3 Dec 1992 20:27:22 GMT Lines: 46