Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!ulysses!hector!jss From: jss@hector.UUCP (Jerry Schwarz) Newsgroups: comp.std.c Subject: Re: __STDC__ and non-strictly conforming ANSI C compilers Keywords: ANSI C, __STDC__ Message-ID: <11018@ulysses.homer.nj.att.com> Date: 16 Dec 88 21:47:18 GMT References: <3236@pegasus.ATT.COM> <9167@smoke.BRL.MIL> <11002@ulysses.homer.nj.att.com> <9198@smoke.BRL.MIL> Sender: netnews@ulysses.homer.nj.att.com Reply-To: jss@hector.UUCP (Jerry Schwarz) Organization: AT&T Bell Laboratories Lines: 43 In article <9198@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) presents a sample of some code > #if __STDC__ > #if _BRAIN_DAMAGED > typedef __far void *far; > #else > typedef void *far; > #endif > extern far gcalloc(size_t size, far *handle); > #else > # if _BRAIN_DAMAGED > extern far char *gcalloc(); > # else > extern char *gcalloc(); > # endif > #endif This is conforming (it may work on some conforming compilers) but not strictly conforming. It will fail on a conforming compiler that defines _BRAIN_DAMAGED and doesn't like __far. A conforming compiler is entitled to behave this way because you're stepping on its reserved namespace. I'd prefer to write something like the following strictly conforming code. #if BRAIN_DAMAGE1 /* stuff to set up for one kind of brain damage */ #elif BRAIN_DATAGE2 /* stuff for another kind of braindamage. */ #else /* This is the only code a conforming compiler will ever see */ typedef void* far ; #endif Jerry Schwarz AT&T Bell Labs, Murray Hill I usually don't add a disclaimer, because I think they are redundant. But the message I'm replying to took a gratuitous swipe at AT&T. So for the record: These are my opinions. I am not a member of the department responsible for AT&T's C compilers.