Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #366862

Re: MCC Compiler

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: MCC Compiler
Date 2023-10-26 09:34 -0700
Organization A noiseless patient Spider
Message-ID <86zg051gx3.fsf@linuxsc.com> (permalink)
References (3 earlier) <86pm21h8es.fsf@linuxsc.com> <uf6a2e$809b$1@dont-email.me> <864jir8fpw.fsf@linuxsc.com> <uhbc8m$rd1b$1@dont-email.me> <87v8aujuxq.fsf@nosuchdomain.example.com>

Show all headers | View raw


Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Bart <bc@freeuk.com> writes:
> [...]
>
>> Or take this sequence:
>>
>>     int a = 0;
>>     int b = {0};
>>     int c = {{0}};
>>
>> The first is OK, so is the second (why?), but the third gives a
>> warning on gcc.  (Mcc passes the first two and fails the third.)
>
> The first and second are OK because the standard explicitly says
> so.  N1570 6.7.9p:
>
>     The initializer for a scalar shall be a single expression,
>     optionally enclosed in braces.
>
> As for the third, with "-std=c17 -pedantic-errors", gcc warns
> "braces around scalar initializer", while clang gives a fatal
> error "too many braces around scalar initializer".
>
> One could argue that "enclosed in braces" allows both {...} and
> {{...}}.  I don't think I'd make that argument myself.  But the
> requirement is in the Semantics section, not Constraints, so
> violating it is not a constraint violation.  IMHO it *should* have
> been a constraint.  I think clang is incorrect to reject it in
> conforming mode, [...]

I don't see how you reach the conclusion about clang.  If you
think that in 6.7.9p11 the phrase "optionally enclosed in braces"
is meant to allow one pair of braces but not more than one, how
is it that you also think clang is not within its rights to
reject the declaration with two pairs of braces?  The two
inferred statements seem inconsistent with respect to each other.
Is it that you think that violating a syntax rule or violating a
constraint are the only things that give an implementation
license to refuse to translate a source file?  (Let me exclude
things like #error and #pragma from the discussion here.)  I have
to admit to being baffled.

Back to comp.lang.c | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: MCC Compiler Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-10-26 09:34 -0700
  Re: MCC Compiler Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-10-26 12:03 -0700

csiph-web