|Alternative C compilers on x86_64 Linux? firstname.lastname@example.org (2016-09-02)|
|Re: Alternative C compilers on x86_64 Linux? email@example.com (jacobnavia) (2016-09-05)|
|Re: Alternative C compilers on x86_64 Linux? firstname.lastname@example.org (2016-09-05)|
|Re: diagnosing C errors, was Alternative C compilers on x86_64 Linux? email@example.com (BartC) (2016-09-09)|
|Re: diagnosing C errors, was Alternative C compilers on x86_64 Linux? firstname.lastname@example.org (Kaz Kylheku) (2016-09-09)|
|Re: diagnosing C errors, was Alternative C compilers on x86_64 Linux? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2016-09-10)|
|Date:||Fri, 9 Sep 2016 12:31:17 +0100|
|Organization:||A noiseless patient Spider|
|References:||16-09-001 16-09-002 16-09-008|
|Injection-Info:||miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="34089"; mail-complaints-to="email@example.com"|
|Posted-Date:||09 Sep 2016 11:51:28 EDT|
On 06/09/2016 01:26, firstname.lastname@example.org wrote:
> On Sunday, September 4, 2016 at 3:56:56 PM UTC-7, jacobnavia wrote:
>> Why should they care? If you write duplicate switch cases its not their
>> fault, its yours.
> It is a constraint violation, and a trivial one, that the compiler
> must identify and report instead of silently producing code that is
> broken or appears to work by chance.
This is C. There are already plenty of things that it lets through that
are probably errors, and which are likely to crash the program.
For example, take a pointer to an array of ints, P. You'd normally
access an int by dereferencing P then applying the index: (*P)[i].
But if, by mistake, you index first then dereference: *(P[i]), then this
still compiles. But is likely to go wrong badly.
By contrast, an inadvertent duplicate case label is a 'soft' error; the
program just won't give the expected results. It's not going to read or
write all over memory it shouldn't, or at least not as directly as will
happen if the compiler blatantly allows pointers (to single targets) and
arrays to be interchanged.
Return to the
Search the comp.compilers archives again.