Related articles |
---|
Alternative C compilers on x86_64 Linux? arnold@skeeve.com (2016-09-02) |
Re: Alternative C compilers on x86_64 Linux? jacob@jacob.remcomp.fr (jacobnavia) (2016-09-05) |
Re: Alternative C compilers on x86_64 Linux? nemo@invalid.invalid (Nemo) (2016-09-04) |
Re: Alternative C compilers on x86_64 Linux? 221-501-9011@kylheku.com (Kaz Kylheku) (2016-09-04) |
Re: Alternative C compilers on x86_64 Linux? bc@freeuk.com (BartC) (2016-09-05) |
Re: Alternative C compilers on x86_64 Linux? fw@deneb.enyo.de (Florian Weimer) (2016-09-05) |
Re: Alternative C compilers on x86_64 Linux? alexfrunews@gmail.com (2016-09-05) |
Re: Alternative C compilers on x86_64 Linux? alexfrunews@gmail.com (2016-09-05) |
Re: Alternative C compilers on x86_64 Linux? 221-501-9011@kylheku.com (Kaz Kylheku) (2016-09-06) |
Re: Alternative C compilers on x86_64 Linux? 221-501-9011@kylheku.com (Kaz Kylheku) (2016-09-06) |
[23 later articles] |
From: | Kaz Kylheku <221-501-9011@kylheku.com> |
Newsgroups: | comp.compilers |
Date: | Sun, 4 Sep 2016 23:48:55 +0000 (UTC) |
Organization: | Aioe.org NNTP Server |
References: | 16-09-001 |
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 |
On 2016-09-02, Aharon Robbins <arnold@skeeve.com> 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<TYPE>(EXPR))
#define convert(TYPE, EXPR) (static_cast<TYPE>(EXPR))
#define coerce(TYPE, EXPR) (reinterpret_cast<TYPE>(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.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.