
From: "Andrei Alexandrescu \(See Website for Email\)" <andrewalex@hotmail.com>
"Rob Stewart" <stewart@sig.com> wrote in message news:200407072103.i67L3Jk28273@tesh.systems.susq.com...
From: brangdon@cix.compulink.co.uk (Dave Harris)
In-Reply-To: <cch4as$941$1@sea.gmane.org> andrewalex@hotmail.com (Andrei Alexandrescu \(See Website for Email\)) wrote (abridged):
I was worried more (only) about the order of evaluation.
v += foo(), bar();
Unless I'm mistaken, there is but one sequence point in such an expression, regardless of whether you overload operator,. Thus, any expression using commas must be understood to have indeterminant order of evaluation.
It is exactly such false sense of security and such misunderstandings that makes me highly suspicious of overloading the comma operator. Worse, comments come that have an apparence of legitimacy. Unless I am even more mistaken, your statement above is false. If that's the case, hey, confusion is among the inner circle... how about the casual users?
If operator, is overloaded, then there is only one sequence point in the above expression. If not, then there are two. I forgot about 1.9/18.
Consider:
int v[] = { foo(), bar() };
Doesn't this exhibit the same problem?
No.
You're right. -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;