Seriously, James? Are we back to this (again). *SIGH* This will be my
last post to you on any issue relating to whether or not compiler authors
agree with me.
The scope here is "on this point." The GCC compiler authors agree with
me (on this point) because they wrote their compilers to operate as I
have indicated. Regardless of their underlying motives, this is what
they wrote. It is the way I have indicated. We are in agreement (on
this point).
If the point was, whether one particular piece of code should be
evaluated in that order, when compiled for a particular target machine,
with a particular set of compiler options, then yes, the fact that gcc
did generate code that evaluated the operands in that order, under those
circumstances, does prove that they agreed with you, on that point.
However, change even a single character in your program, or change one
compiler option, or change the target system, and it's entirely possible
that you'll find gcc generating code that evaluates the operands in the
other order.
I had thought that your point was more general than that? I had thought
your point was your claim that the C standard should always specify the
precise order of evaluation of all sub-expressions, and that this should
specify the same order as the one that you personally considered to the
right one.
No single example (in fact, no finite number of examples) of how gcc
compiles code can prove that the gcc implementors agree with you on that
more general point. It could be disproven by observing gcc generating
different orders in different circumstances. It can be disproven by
talking with the developers, or by examining records of their design
documents or their design discussions. However, no matter how many
examples you find in which they always use the same order you approve
of, the very next example might show the other order, so no finite
number of such examples can show that they agree with you.
Seriously? When we're in agreement, it cannot be true? And when we're
in disagreement it's patently clear that it is true? NO! I cannot
believe that you are really like this, James. It's amazing me. I'm
literally sitting here beside myself.
There's three options: they
A) believe that the order should always be left-to-right
B) believe that the order should, in some cases, be left-to-tight, and
at other cases, be right-to-left
C) believe that the order should always be right-to-left
No finite number of examples can disprove B; unless you know which cases
they consider relevant. That opinion is perfectly consistent with any
arbitrarily long list of cases in which the exact same order was chosen.
However, a single counter-example is sufficient to disprove either of
the other two possibilities. Your one example with gcc cannot disprove
that they believe B. But a single counter-example from Microsoft can
disprove that they believe it should always be the same order as
whichever one you consider appropriate.
*SIGH* By your own line of reasoning whether or not they actually
disagree with me cannot be known. For example, you say that the GCC
authors could've disagreed with me, but for whatever reason chose to
code in the manner I prescribe. Well, the same applies here, James.
No it doesn't, because of the difference between the belief that a
particular fixed evaluation order should be used, and the belief that it
should be different in different cases. A single counter-example is
sufficient to disprove holding of the first belief, while no finite
number of examples can disprove holding of the second (unless you know
which cases matter, in which you can choose the examples to explore
those cases).
The Microsoft authors could've agreed with me, but for whatever reason
chose to code in a manner contrary to the one I prescribe.
Do you have any reason why you would have chosen to code in a manner
contrary to the one that you yourself have prescribed? If so, then in
what sense have you prescribed it? If not, they they are in disagreement
with you, if only with regard to whether or not the reason they had was
sufficient to justify ignoring your prescription.
.....
I think that's one of the advantages of the GCC compiler toolchain:
that it's multi-platform, and there aren't staunch variations like
this across implementations. Perhaps between version 4.5 and 4.6
there are changes, but all 4.5 on all platforms should work nearly
perfectly, as will all 4.6 versions, and so on.
Do you have evidence of to support your claim that they fail to take
advantage of platform-specific optimizations? I know that they allow you
to explicitly request a very large array of different platform-specific
optimizations. That their default optimizations would never be
platform-dependent suggests far less competence than I thought they had.
Also, by "context", I was not just referring to the platform. The
sub-expression of an assignment expression might be evaluated in one
order in one place, and in a different order in a different place within
the same program being compiled for a particular platform. Among the
things likely to influence this decision is the kind of expression being
evaluated, and whether or not nearby code provides opportunities to
evaluate common sub-expressions only once, rather than multiple times.
I don't know. I can see arguments either way.
If you don't know of a specific platform where there are very good
reasons for using the opposite direction from the one you think should
be mandatory, then you don't know enough to weigh in on this issue. Such
platforms do exist, though I personally couldn't tell you which ones
they are. My specialty is portable code - I know what's possible, and I
know how to write my code to work regardless of which possibility comes
up, but I've no need to remember which systems that possibility actually
comes up for. People with more knowledge of specific platforms could
probably identify them for you.