Which compiler are you using? Every compiler I know reads within ( ) first, and then from right to the left. The only time the code I present would have a problem was if the 'a' was a zero (0), because it will crash if you try to divide anything by '0'.
--- On Thu, 7/16/09, Paul Herring <[email protected]> wrote: From: Paul Herring <[email protected]> Subject: Re: [c-prog] I am not agree with u. To: [email protected] Date: Thursday, July 16, 2009, 2:04 PM On Thu, Jul 16, 2009 at 4:54 PM, Michael White<[email protected]> wrote: > A way to help determine how you want the following scenario to play out > is to surround the piece of code you want to be sure is enacted on first with > ( ). > > For example... > > int b = a / (++a); > > This will remove all doubt as to what will happen. No it won't. Adding parenthesis does absolutely nothing in this situation. It's still invalid code, because either the numerator or denominator can be examined first, leading to two different possible answers. -- PJH http://shabbleland.myminicity.com/com http://www.chavgangs.com/register.php?referer=9375 ------------------------------------ To unsubscribe, send a blank message to <mailto:[email protected]>.Yahoo! Groups Links [Non-text portions of this message have been removed]
