What pray means "undefined", then?
"undefined" means anything is permissible. It doesn't mean you have to do
something unpredictable.
Note that "undefined" and "unspecified" are NOT the same thing.
That's nondeterminism, chump.
No, it isn't.
Here's the difference. You have advocated that the standard should
*require* left-to-right evaluation. In fact, the standard makes no
requirements as to order of evaluation except when there's a sequence
point.
You have claimed that the standard "requires nondeterminism". If this
were the case, the standard would be *prohibiting* left-to-right evaluation,
but in fact, it does not; an implementor is free to implement left-to-right
evaluation, just as an implementor is free to implement right-to-left
evaluation, or evaluation which is left-to-right for most functions
and right-to-left for variadic functions.
There is a difference between "you may do whatever you wish" and "you must
do something random".
You had a chance to change it and you blew it.
Except that you have yet to make any argument stronger than "some random
guy on Usenet claims without support that intelligent people would expect
this".
The arguments don't fail.
They certainly do. Hint: If you haven't persuaded anyone, that usually
means your argument has failed.
It's absurd to allow a()+b() to be reordered
when this isn't done for a()||b().
Except you've already been told why it isn't.
And you apparently don't even
understand my contention: that the "indeterminacy" is not a positive
and observable thing, because most C programmers stay with one
compiler or a narrow range, and they see determinacy...yet are blamed
for your screwup because they haven't read the standard!
Name one.
Seriously, you're claiming "most C programmers" are confused by this, but
you've yet to demonstrate that even ONE programmer has been confused by
this. Every book I'm aware of states it explicitly, and I have never in
all my years of programming and reading C code seen a single person make
a mistake with this.
No, I have said that while I was asked Princeton to teach C, and
assist a Nobelist with C, and delivered classes in C at a Chicago
corporation, I realized that C was inadequate for development and
stopped using it circa 1993. Therefore, I've probably "forgotten more
than you know".
You currently don't know much about it, and demonstrably, your beliefs about
C are full of crazy.
I've met many people who have tought classes they were woefully unqualified
for.
Since programming languages are not hard to learn if one has a solid
foundation (which you appear to lack)
You haven't really established this. FWIW, I've never had any trouble picking
up programming languages.
I am rapidly getting back up to
speed, not because I like C, but because I think it's repellent what
you do in its name to people like Navia and Schildt. I think your
behavior is unacceptable and if I have to relearn C to tear you a new
asshole, I will.
Good luck with that. If I'm wrong, I anticipate being corrected.
I advise you in fact to review the code I posted in response to the
request for guidance to the poster on infix to Polish. I challenge you
to post a Vicious Little Tirade about the errors in this code. It is
the result of my relearning process and it took two hours.
Wow.
Well, I did indeed respond to it. I just sorta skimmed after a while,
there was not much point.
What I have learned makes me sick.
It ain't what you don't know that gets you, it's what you know that ain't
so.
I have yet to see you make a claim about C standardization that was not
false.
SURRENDER BAD C!
Okay. C, TCR 3e, page 735
The way an order-of-evaluation error usually occurs is through
changes to an existing statement. For example you may enter
the statement
x = *p++;
which assigns the value pointe to by p to x and then increments
the pointer p. Say, however, that you later decide that x
really needs the value pointed to by p squared. To do this,
you try
x = *p++ * (*p);
However, this can't work because p has already been incremented.
The proper solution is to write:
x = *p * (*p++);
Errors like this can be very hard to find.
We can't tell whether he thinks the parentheses matter, or whether he
thinks this is evaluated left-to-right. You might think it's the latter,
but consider page 56::
The ANSI C standard does not specify the order in which the
subexpressions of an expression are evaluated. This leaves the
C compiler free to rearrange the expression to produce more optimal
code. However, it also means that your code should never rely
on the order in which subexpressions are evaluated. For example,
the expression
x = f1() + f2();
does not ensure that f1() will be called before f2().
Presumably, then, he thinks the parentheses change this or something? We
may never know.
If the order of evaluation of a()+b() is undefined across compilers
they cannot do this.
Unspecified, not undefined. The terms have precise meanings.
And yes, they can: They can write code which does not depend on that
decision. Which everyone I have ever met has been doing successfully
for years.
The rule you apply here is administrative, although expressed
colloquially: "don't bite the hand that feeds you".
No, it's actually much simpler: "Don't listen to the crazy guy who has
never presented even a single anecdotal story to support his claims."
Come on, at least give us ONE concrete example of a vendor laying off
compiler developers because they had a guy who would have been working on
fixing order of evaluation if it had changed, but then it didn't get
changed so they fired him.
It doesn't work that way.
Well, it does, actually.
Instead, "consultants" make fat hourlies
while working excessively to port the code.
Please let us know where these "fat hourlies" are available for porting C
code. I've never seen it.
Business is irrational and
barbaric. The only reason C is preserved is that C programmers won't
learn better languages.
And partially because, for many of the things C is good at, no better
languages are yet on offer.
C Sharp & Java. Both of these reject reordering of a()+b() and after
precedence, evaluate left to right.
Can't speak to C Sharp much. (Obviously, "portability" is a moot point
there.) But let's keep Java in mind, then.
And yes, I am a highly intelligent person, so much so, in fact, that
in communities of stupid people some think me crazy.
I'm glad for you. I'm not especially dumb myself. But that doesn't
mean that your intuition is the gold standard of language design. SURRENDER
EVIDENCE!
It also drives narrow and brutalized specialists like Heathfield, you
and Thompson that I didn't have to make "learning C" a lifetime
calling.
You dropped a word, but actually, you'd be wrong anyway. I wouldn't call
"learning C" a lifetime calling. It's been one of my favorite hobbies, but
it's not as though I've spent more time on C than I have on, say, Dungeons
& Dragons, or reading science fiction, or playing video games, or writing.
The fact is that each one of us has had to sell too much of his time
and spirit to some uncaring corporation or other organization. Nearly
all of you have had to work unpaid overtime.
Probably, although $dayjob's pretty good about making it up to us.
Nobody's capable of thinking themselves at all "intelligent" unless
constantly and addictively reassured by meaningless victories over
code that was in most cases poorly designed in a hack o rama, like
rats pressing a lever.
Actually, I'm pretty much capable of thinking myself intelligent regardless,
because I have a psych degree and have been through more various tests
of cognitive function than I once suspected had ever been developed.
Therefore I am not at all impressed by the savagery of your Vicious
Little Tirade because people are more important than "correct"
software, especially because your claims that it doesn't matter
whether a or b is printed first shows you wouldn't know correct
software if it bit you in the butt.
You keep doing all this ranting, but you never actually present evidence
for your claims. You brag about how qualified you are to present the
evidence. Fine, let's assume you're qualified. So present the evidence
already!
-s