Skip to content

Define "trickyness" in for-loop pattern #148

Description

@bradym80

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"?

Activity

  1. klomontes commented on Jun 15, 2015

    @klomontes

    @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. :)

  2. sumn2u commented on Jun 16, 2015

    @sumn2u

    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.

  3. gianlucascoccia commented on Jul 1, 2015

    @gianlucascoccia

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions