Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Why I use gcc Date: Mon, 26 Sep 2016 17:39:19 -0700 Organization: None to speak of Lines: 39 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="4904"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kLCAyffrZXyUzr96a3yGl" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:vTRaEFA9PNGpsHbwc2FP7tIXaC4= sha1:8AGF4U1RQrh8ny8ksIAeN8eV3rg= Xref: csiph.com comp.lang.c:94115 BartC writes: > On 26/09/2016 17:30, BartC wrote: >> Apparently the solution, according to David Brown, is not to fix the >> various compilers but to introduce lots of conditional macros enumerated >> by target compiler. > > If anyone wants to go this route for any purpose then these appear to be > the macros defined by the half-dozen compilers I use: > > #if defined __LCC__ > #error "THIS IS LCC" > > #elif defined __POCC__ > #error "THIS IS PELLES C" > > #elif defined __DMC__ > #error "THIS IS DMC" > > #elif defined __GNUC__ > #error "THIS IS GCC" > > #elif defined __TINYC__ > #error "THIS IS TCC" > > #elif defined __clang__ > #error "THIS IS CLANG" > > #endif Clang defines both __clang__ and __GNUC__ (presumably because it endeavors to be gcc-compatible), so you should test __clang__ first. [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"