Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define "trickyness" in for-loop pattern #148

Open
bradym80 opened this issue Apr 10, 2015 · 3 comments
Open

Define "trickyness" in for-loop pattern #148

bradym80 opened this issue Apr 10, 2015 · 3 comments

Comments

@bradym80
Copy link

On line 35 of the for-loop pattern the following comment appears.

// optimization 3 - substitute i++withi = i + 1 ori += 1 to avoid excessive trickiness

Could you elaborate on "excessive trickiness"?

@klomontes
Copy link

@bradym80 I was wondering the same thing. My assumption was that i = i + i is easier to understand since i++ requires some previous knowledge about this iterator. Not sure if there are some performance differences.

Anyway, I find i++ beautifully succinct and not tricky at all. :)

@sumn2u
Copy link

sumn2u commented Jun 16, 2015

When you write these expressions as i = i + 1 it's clear what the intent of the programmer was and easier to find bugs in the code where as i++ prevents excess craftiness.

@gianlucascoccia
Copy link

Well, if i++ is too tricky I find it funny that in preferred 1 and 2 you use i-- :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants