My reading is that it places limits on what must be accepted by
the compiler but doesn't otherwise change the applicable semantic
descriptions. This shouldn't be a strange idea, as after all it
is what people expect for environmental limits -- the compiler
may reject any program that exceeds an environmental limit, but
if the program is accepted then the compiler better follow the
given semantic descriptions. I think the difference is primarily
one of expectation -- we expect a constraint violation will
result in a program being rejected, whereas we hardly ever expect
a program will be rejected because an environmental limit was
exceeded (and certainly the hope is that the program will not be
rejected!).
I expect there is some interesting reading there. I would be
more enthusiastic if the "improved" Google groups interface
weren't so abysmally bad. :(
> One relevant post from 2007 (note that Doug Gwyn is a member of the
> Committee):
>
>
https://groups.google.com/group/comp.std.c/msg/4661905eda66827?dmode=source&output=gplain&noredirect
>
> "Douglas A. Gwyn" <
DAG...@null.net> writes:
> [...]
> > Issuance of a "diagnostic" (meeting the implementation definition for
> > identification, required for conformance to the C standard) implies
> > rejection of the program (again, insofar as conformance is concerned).
> > If an implementation wants to proceed to do something further with
> > the translation unit, typically to continue processing to potentially
> > generate additional diagnostics but also to go ahead and produce
> > object code, then that is its business and it is allowed to do so.
>
> I like that interpretation, and I wish it were clearly stated in the
> standard.
Note that the long paragraph doesn't say one way or the other as
to whether the proceeding compilation is obliged to honor other
semantic descriptions that are well-defined. The author may have
a position on the subject, but I don't think this paragraph
clearly expresses it.
> I think the bottom line is that the standard is unclear about
> the semantics, if any, of programs that violate constraints, and
> particularly about the definition of "constraint". A clear statement
> in the standard (even in a note) that any program that violates a
> constraint, if it's accepted, has undefined behavior would settle
> the issue. A clear statement of the opposite would do so as well.
I agree 100%.
> *If* my interpretation is correct, then the cases where a description
> of the semantics applies even when a constraint is violated (as in
> the definition of simple assignment) can be explained as avoiding
> redundancy. Yes the semantics section under "Simple assignment"
> says that the RHS is converted to the type of the LHS; it doesn't
> say *again* that the type must meet the constraints because that's
> already been stated.
>
> It seems odd to me to permit a compiler to reject a given construct,
> but to impose specific requirements on its behavior if it's accepted.
> A programmer cannotr reasonably depend on such a guarantee. On the
> other hand, there are plenty of things in the standard that I find
> odd, so that doesn't prove anything.
It doesn't seem so odd to me because there are at least two other
cases where the Standard does just that, those being exceeding an
environment limit and use of a conditionally present feature (of
which C11 has too many IMO, but that is a separate discussion).
> [SNIP]
>
>> To try to bring the conversation up a level: the essential point I
>> was trying to make is that the question is not black and white.
>> Reasonable people can disagree here.
>
> I believe we've demonstrated that by being reasonable people
> disagreeing about it. 8-)}
Just so. :)
>> In the interest of giving a
>> fair presentation under such circumstances, I think it's better to
>> give a qualified statement rather than treating the matter as
>> completely settled.
>
> Hmm. Feel free to assume that anything posted under my name is prefixed
> with "In my opinion, ".
There are two reasons why I hope you'll reconsider this response.
First, I don't think it's really an accurate description all the
time. Some of the things you say you consider (I believe) to be
simply indisputable, ie, that no reasonable (and informed) person
would disagree. For example, the printf() statement you mentioned
earlier as not being strictly conforming -- this is not just an
opinion, as it cannot be reasonably disputed. It is valuable to
distinguish these two kinds of situations.
Second, and probably more important, I'm not the only audience for
your comments. Lots of people read what you have to say, and it
helps them understand not just the language but also the culture
of people who are interested in the language definition, and how
firm or weak the consensus is in different areas. IMO you would
be doing them a disservice to voice statements of opnion as if
they are statements of fact, or to not distinguish between cases
where you are giving a statement of opinion and where you feel
there is overwhelming consensus on a particular issue. By all
means, in any case where you feel there is overwhelming consensus,
please go ahead and respond unequivocally. In other cases,
however, where there is not such a strong consensus, and you
think reasonable people can disagree, I hope you'll agree that
it is better to express such remarks in a qualified way, so
readers get a more rounded view of the discussional landscape.