This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Assignment operator


> From: Zoltan Kocsi <zoltan@bendor.com.au>
> Date: Mon, 11 Oct 1999 21:48:57 +1000 (EST)
> To: gcc@gcc.gnu.org

> I hope I'm at the right place finally to seek some help.

> I raised my concerns on various newsgroups and I was advised that
> gcc must do that because that's what the standard says.  I then
> contacted the standard committee, suggesting a change in the wording
> of the assignment operator. They replied me that the standard does
> *not* require a re-fetch of the LHS even if it was volatile,
> although it permits it. They also said that they deliberately left
> that slack in the standard.

I'd love to see the verbiage, if you have it, both your question, and
their answer.  I'd like to see who said it as well.

> In the light of the above, would that be a possibility that the
> compiler behaviour could be changed (with a command line flag) so
> that the value of an assignment can be either the value of the left
> hand side read back (this is the current interpretation) or the
> value that is written to the left hand side - thus making assignemnt
> to behave identically for volatile/non-volatile LHS and avoiding all
> the possible misinterpretation traps.

A flag could be added, though I'd rather fix the standards, and get C
and C++ to follow the same rule for the same reason.  We then take the
hit, and fix the compiler once, with one semantic.  Until that is
done, this is going to be non-portable and programmers should stay
away from this construct.  Given that we _might_ change the compiler
in the future, the construct should be avoided.

I don't think a flag is the best approach.  I am against having a flag
for this.

I am sorry our decision and wording was so lax.  I think in the next
round it should be fixed.  Be sure to petition ANSI/ISO to fix this
next time you have the opportunity.

Sorry.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]