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. We always use "i" as a loop counter...

We always use "i" as a loop counter...

Scheduled Pinned Locked Moved The Weird and The Wonderful
c++
5 Posts 5 Posters 30 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.
  • H Offline
    H Offline
    Hal Angseesing
    wrote on last edited by
    #1

    ...so lets make it global. This was the answer of a "Technical Consultant" that I worked with many years ago. All of his loops were for i = 1 to 10 next i. This was VB 3 - so some time ago! To save himself the effort of dim i as integer at the beginning of every function he wanted to use "i" he just made it a global. I can't blame him too much - he was a COBOL programmer who had made the leap to VB. It made for some surprisingly subtle bugs! Needless to say that I removed it after having to try quite hard to show him the benefits (I was a junior C++ programmer at the time).

    B T D J 4 Replies Last reply
    0
    • H Hal Angseesing

      ...so lets make it global. This was the answer of a "Technical Consultant" that I worked with many years ago. All of his loops were for i = 1 to 10 next i. This was VB 3 - so some time ago! To save himself the effort of dim i as integer at the beginning of every function he wanted to use "i" he just made it a global. I can't blame him too much - he was a COBOL programmer who had made the leap to VB. It made for some surprisingly subtle bugs! Needless to say that I removed it after having to try quite hard to show him the benefits (I was a junior C++ programmer at the time).

      B Offline
      B Offline
      BSelznick
      wrote on last edited by
      #2

      We must have worked with the same guy! I once worked on a VB program with a couple of hundred global variables. When i complained to the original developer he said, "What's wrong with that?" Funny, this guy was an author of multiple VB books. Bill Selznick Bits 2 Systems LLC bselznick@bits2systems.com

      1 Reply Last reply
      0
      • H Hal Angseesing

        ...so lets make it global. This was the answer of a "Technical Consultant" that I worked with many years ago. All of his loops were for i = 1 to 10 next i. This was VB 3 - so some time ago! To save himself the effort of dim i as integer at the beginning of every function he wanted to use "i" he just made it a global. I can't blame him too much - he was a COBOL programmer who had made the leap to VB. It made for some surprisingly subtle bugs! Needless to say that I removed it after having to try quite hard to show him the benefits (I was a junior C++ programmer at the time).

        T Offline
        T Offline
        Ted Ferenc
        wrote on last edited by
        #3

        many years ago I saw the same years ago in a FORTRAN prog, as you say some of the bugs this introduced were interesting. Perhaps this guy used to work in England?


        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        1 Reply Last reply
        0
        • H Hal Angseesing

          ...so lets make it global. This was the answer of a "Technical Consultant" that I worked with many years ago. All of his loops were for i = 1 to 10 next i. This was VB 3 - so some time ago! To save himself the effort of dim i as integer at the beginning of every function he wanted to use "i" he just made it a global. I can't blame him too much - he was a COBOL programmer who had made the leap to VB. It made for some surprisingly subtle bugs! Needless to say that I removed it after having to try quite hard to show him the benefits (I was a junior C++ programmer at the time).

          D Offline
          D Offline
          Duncan Edwards Jones
          wrote on last edited by
          #4

          Had this man not heard of DefInt? :laugh: (Worst keyword ever - except perhaps As Any!)

          '--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd

          1 Reply Last reply
          0
          • H Hal Angseesing

            ...so lets make it global. This was the answer of a "Technical Consultant" that I worked with many years ago. All of his loops were for i = 1 to 10 next i. This was VB 3 - so some time ago! To save himself the effort of dim i as integer at the beginning of every function he wanted to use "i" he just made it a global. I can't blame him too much - he was a COBOL programmer who had made the leap to VB. It made for some surprisingly subtle bugs! Needless to say that I removed it after having to try quite hard to show him the benefits (I was a junior C++ programmer at the time).

            J Offline
            J Offline
            John R Shaw
            wrote on last edited by
            #5

            Hal Angseesing wrote:

            ...so lets make it global.

            :wtf: I am cringing at the very thought of that! :laugh: The largest application (written in C) I ever worked on had more global variables than I bothered to count. I was not allowed to create the original but I was the one who had to fix it for release to the public. When I examined the original code, for the first time, I found a dozen ways to crash the system within 15 minutes of opening the sources files, what a mess. :omg: Do not worry! The finished product worked just as required and would no longer crash the system if looked at it wrong. ;)

            INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

            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