Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Now that's a first [modified]

Now that's a first [modified]

Scheduled Pinned Locked Moved The Weird and The Wonderful
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wes Jones
    wrote on last edited by
    #1

    In all of computer programdom, I've never encounterd this arrangement of i & iCount in a for loop:

    i = getcountofsomething()
    For iCount = 0 To i
      If something(iCount)) Then
        bOk = True
        Exit For
      End If
    Next iCount
    

    modified on Thursday, February 11, 2010 6:33 PM

    OriginalGriffO D A 3 Replies Last reply
    0
    • W Wes Jones

      In all of computer programdom, I've never encounterd this arrangement of i & iCount in a for loop:

      i = getcountofsomething()
      For iCount = 0 To i
        If something(iCount)) Then
          bOk = True
          Exit For
        End If
      Next iCount
      

      modified on Thursday, February 11, 2010 6:33 PM

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      It's not that bad - I assume getcountofsomething() takes a while, so the coder has just manually optimised it out of the loop.

      If Barbie is so popular, why do you have to buy her friends? Eagles may soar, but weasels don't get sucked into jet engines. If at first you don't succeed, destroy all evidence that you tried.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      W 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        It's not that bad - I assume getcountofsomething() takes a while, so the coder has just manually optimised it out of the loop.

        If Barbie is so popular, why do you have to buy her friends? Eagles may soar, but weasels don't get sucked into jet engines. If at first you don't succeed, destroy all evidence that you tried.

        W Offline
        W Offline
        Wes Jones
        wrote on last edited by
        #3

        nah, it's bad. who names their variables like this in a for loop? were it written "for i = 0 to iCount", I'd be giving this guy a high 5 already.

        C 1 Reply Last reply
        0
        • W Wes Jones

          nah, it's bad. who names their variables like this in a for loop? were it written "for i = 0 to iCount", I'd be giving this guy a high 5 already.

          C Offline
          C Offline
          Chris Maunder
          wrote on last edited by
          #4

          A high 5 around the earhole?

          cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

          W 1 Reply Last reply
          0
          • W Wes Jones

            In all of computer programdom, I've never encounterd this arrangement of i & iCount in a for loop:

            i = getcountofsomething()
            For iCount = 0 To i
              If something(iCount)) Then
                bOk = True
                Exit For
              End If
            Next iCount
            

            modified on Thursday, February 11, 2010 6:33 PM

            D Offline
            D Offline
            Daniel Grunwald
            wrote on last edited by
            #5

            It's straight from the guide on How To Write Unmaintainable Code[^]:

            Never use i for the innermost loop variable. Use anything but. Use i liberally for any other purpose especially for non-int variables. Similarly use n as a loop index.

            W 1 Reply Last reply
            0
            • D Daniel Grunwald

              It's straight from the guide on How To Write Unmaintainable Code[^]:

              Never use i for the innermost loop variable. Use anything but. Use i liberally for any other purpose especially for non-int variables. Similarly use n as a loop index.

              W Offline
              W Offline
              Wes Jones
              wrote on last edited by
              #6

              lol! I think they were using that as the coding standards document!

              1 Reply Last reply
              0
              • C Chris Maunder

                A high 5 around the earhole?

                cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                W Offline
                W Offline
                Wes Jones
                wrote on last edited by
                #7

                not a bad idea!

                1 Reply Last reply
                0
                • W Wes Jones

                  In all of computer programdom, I've never encounterd this arrangement of i & iCount in a for loop:

                  i = getcountofsomething()
                  For iCount = 0 To i
                    If something(iCount)) Then
                      bOk = True
                      Exit For
                    End If
                  Next iCount
                  

                  modified on Thursday, February 11, 2010 6:33 PM

                  A Offline
                  A Offline
                  Avi Berger
                  wrote on last edited by
                  #8

                  You just don't understand. If the variable was named count you would have a point. Here, the programmer was helping the poor computer with its communications skill. Hence naming the variable that the computer uses to count from its own perspective - "I Count"

                  Please do not read this signature.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups