> On 14 Oct 2015, at 9:50 am, Greg Parker <[email protected]> wrote:
> 
> You can avoid confusion (human and compiler) by writing the statement without 
> the preincrement's side effect:
>    ix = (ix+1) % guess.count;
> 


OK, makes sense.

I think my use of the preincrement followed by mod stems from years-old habits 
of writing embedded software, where ++<var> would typically compile to a single 
instruction on the 8051 or similar where every clock cycle counted (and 
<var>=<var>+1 would not). I guess these days it’s a moot point :)

—Graham



_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to