A
Alex Fraser
Dan Pop said:I think you mean constraint violation.
What is the distinction? Isn't what the standards term a constraint
violation just a type of semantic error?
Alex
Dan Pop said:I think you mean constraint violation.
Alex Fraser said:What is the distinction? Isn't what the standards term a constraint
violation just a type of semantic error?
>
> Even when invoked as a C compiler?
>
> With '+'. That is when one looks at the operators in the precedence
> "level" with the '++' and unary '+' it says precedence is left to rigth,
> I would have thought, reading left to right and being greedy we'd get
>
> j = ++(+i);
>
> which is illegal.
> (It's not an operator precedence thing; changing "+x = 42;" to "(+x) = 42;"
> makes no difference.)
>
> The same bug occurs in several other gcc releases. It was fixed
> some time between gcc 3.2 and 3.3.2.
What I remember from discussions quite some time ago, the unary + was
initially put into gcc by just ignoring it in almost all aspects. That
was the quickest way to put it in the compiler. But I think Chris Torek
knows more about it. ...
A bit more experimenting leads me to believe that
gcc implemented it as a cast in some cases. Consider:
short vthree = 0;
+vthree = 42;
which elicits the error message:
ANSI C forbids use of cast expressions as lvalues
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.