In the statement "a *= expression" is expression assumed to be
parenthesized ? For example if I write "a *= b+c" is this the same
as "a = a * (b+c)" or "a = a * b+c" ?
Two correct answers have already been offered:
(1) Compare precedence of " *= " with " + ".
(2) Write a test program and find out.
I'll offer a little "meta-discussion".
First, is it really conceivable that someone would invent a language
in which
a *= b+c
*really* becomes
a = (a*b) + c
?
If you really suspected this might be the case, then you either have
*very*
poor intuition about expression "design" or you've somehow concluded
that the C language was designed by a sadist, who's trying to trick you
with peculiar rules.
You indicate that you didn't want to experiment out of fear the result
was
compiler dependent! Again, if you could imagine that such a simple
expression
could be compiler dependent you've acquired a poor impression of C.
Frankly, postings in this newsgroup may be partly to blame for creating
the misconception that (any but rarish) C expressions are ambiguous.
For example, in another thread I introduced an interesting issue, but
added a peculiar formula, which relied on function pointers all
smelling
the same, for humorous effect. The interesting part of the post was
ignored, but several responses, while acknowledging that function
pointers
probably always smell the same on all present implementations, focussed
on the question of whether this was spelled out in the Standard.
C started out with a philosophy that is the antithesis of languages
like C++.
In the "old days", C textbooks happily acknowledged that some details
were machine-dependent and enocuraged experimentation if you weren't
sure how your machine worked!
Standardization has its purpose, but I think you'll be a happier and
more
successful C programmer if you can acquire some of the more
"old fashioned" C spirit.
Take this message to heart and soon you'll be doing things much harder
than
a *= b+c
without needing help from Usenet.
James Dow Allen