Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Kaz Kylheku <221-501-9011@kylheku.com> Newsgroups: comp.compilers Subject: Re: Alternative C compilers on x86_64 Linux? Date: Sun, 4 Sep 2016 23:48:55 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 27 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <16-09-004@comp.compilers> References: <16-09-001@comp.compilers> Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="39424"; mail-complaints-to="abuse@iecc.com" Keywords: C Posted-Date: 05 Sep 2016 21:11:43 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1743 On 2016-09-02, Aharon Robbins wrote: > Can I get recommendations for other (free) C compilers besides GCC and CLANG? > I've been using the revived PCC for gawk development since it's faster > than GCC, but recently it's developed a bug where it won't compile the > current (valid) code. Hi Aharon, One idea is to treat C++ as a C dialect; then the GCC and Clang C++ compilers are an option. You can't use C features that aren't in C++ and vice versa. Except those that you can hide behind a macro that is conditionally defined for C and C++. I do this with casts, which is useful: #ifdef __cplusplus #define strip_qual(TYPE, EXPR) (const_cast(EXPR)) #define convert(TYPE, EXPR) (static_cast(EXPR)) #define coerce(TYPE, EXPR) (reinterpret_cast(EXPR)) #else #define strip_qual(TYPE, EXPR) ((TYPE) (EXPR)) #define convert(TYPE, EXPR) ((TYPE) (EXPR)) #define coerce(TYPE, EXPR) ((TYPE) (EXPR)) #endif The code compiles as C, but if treated as C++, it benefits from these more constrained, safer casts.