roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) writes:
> In article <878x259yx5.fsf@kvetch.smov.org>,
> Keith Thompson <kst-u@mib.org> wrote:
>
>>int 1[3] = {10,10,10};
>
>>As others have said, the above line is not valid C; any C compiler
>>must issue a diagnostic (probably something like "parse error" or
>>"syntax error") if it processes that line in a C source file.
>
> Is there a specific constraint that it violates that would
> rule out the "compilers may implement extensions that do not
> change the meaning of any valid C program" generality?
>
> Yes, it is not valid syntax in standard C, but it does not,
> for example, violate the constraint that the array size given
> must be a positive integer constant. I don't believe there is
> any specific constraint against introducing new syntax.
There doesn't have to be a constraint; it's enough that it's a syntax
error. C99 5.1.1.3:
A conforming implementation shall produce at least one diagnostic
message (identified in an implementation-defined manner) if a
preprocessing translation unit or translation unit contains a
violation of any syntax rule or constraint, even if the behavior
is also explicitly specified as undefined or
implementation-defined.
There's no exception to this requirement for extensions; if an
implementation allows the line in question as part of an extension, it
still must issue the required diagnostic, at least in conforming mode.
(In a non-conforming mode, of course, the standard cannot impose any
requirements whatsoever.)
--
Keith Thompson (The_Other_Keith) <kst-u@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"