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. The Lounge
  3. POLL: Programming style - i++ vs. ++i

POLL: Programming style - i++ vs. ++i

Scheduled Pinned Locked Moved The Lounge
htmlvisual-studiodesignbusinesshelp
26 Posts 19 Posters 3 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.
  • J Jonathan de Halleux

    I use foreach. :) Jonathan de Halleux - My Blog

    R Offline
    R Offline
    roel_
    wrote on last edited by
    #17

    Spoken with wisdom :)

    1 Reply Last reply
    0
    • L Lost User

      ++i is safe there but a bad habit in other places so I stick with i++. Elaine :rose: The tigress is here :-D

      P Offline
      P Offline
      peterchen
      wrote on last edited by
      #18

      Trollslayer wrote: but a bad habit in other places where? (never encountered one)


      we are here to help each other get through this thing, whatever it is Vonnegut jr.
      sighist || Agile Programming | doxygen

      1 Reply Last reply
      0
      • C Christian Graus

        ++i, for sure. Although a compiler may optimise, it's in theory more efficient, and never less so. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

        P Offline
        P Offline
        peterchen
        wrote on last edited by
        #19

        exactly my thought - dunno why you were voted down...


        we are here to help each other get through this thing, whatever it is Vonnegut jr.
        sighist || Agile Programming | doxygen

        C 1 Reply Last reply
        0
        • P peterchen

          After a batch of interviews, the second most notable thing is that where both ++i and i++ are possible, all candidates used i++ Having optimizied for older compilers I automatically opt for the "simpler" concept of ++i except where I explicitely need the postfix increment. (I now that it makes no difference to today's compilers, but it might still save some microseconds when compiling :rolleyes: ) so - Vote 5 if it's for(int i=0; i<n; ++i) , and Vote 1 if it's for(int i=0; i<n; i++) for you. if the "programming" in the title triggers a pawlowian in you, please vote 3


          we are here to help each other get through this thing, whatever it is Vonnegut jr.
          sighist || Agile Programming | doxygen

          M Offline
          M Offline
          megaadam
          wrote on last edited by
          #20

          // real programmers use i = false ? 1 - i : 1 + i; :suss: _____________________________________ Action without thought is not action Action without emotion is not life

          1 Reply Last reply
          0
          • P peterchen

            After a batch of interviews, the second most notable thing is that where both ++i and i++ are possible, all candidates used i++ Having optimizied for older compilers I automatically opt for the "simpler" concept of ++i except where I explicitely need the postfix increment. (I now that it makes no difference to today's compilers, but it might still save some microseconds when compiling :rolleyes: ) so - Vote 5 if it's for(int i=0; i<n; ++i) , and Vote 1 if it's for(int i=0; i<n; i++) for you. if the "programming" in the title triggers a pawlowian in you, please vote 3


            we are here to help each other get through this thing, whatever it is Vonnegut jr.
            sighist || Agile Programming | doxygen

            D Offline
            D Offline
            David Wulff
            wrote on last edited by
            #21

            peterchen wrote: please vote 3 Won't that skew the results? I thought different levels of members got different vote weights. :~ FWIW I'm an i++ guy.


            David Wulff The Royal Woofle Museum

            Putting the laughter back into slaughter

            1 Reply Last reply
            0
            • P peterchen

              After a batch of interviews, the second most notable thing is that where both ++i and i++ are possible, all candidates used i++ Having optimizied for older compilers I automatically opt for the "simpler" concept of ++i except where I explicitely need the postfix increment. (I now that it makes no difference to today's compilers, but it might still save some microseconds when compiling :rolleyes: ) so - Vote 5 if it's for(int i=0; i<n; ++i) , and Vote 1 if it's for(int i=0; i<n; i++) for you. if the "programming" in the title triggers a pawlowian in you, please vote 3


              we are here to help each other get through this thing, whatever it is Vonnegut jr.
              sighist || Agile Programming | doxygen

              A Offline
              A Offline
              Antony M Kancidrowski
              wrote on last edited by
              #22

              Strange for incrementing integers in for statements I use i++ For incrementing itterators I use ++it. Ant. I'm hard, yet soft.
              I'm coloured, yet clear.
              I'm fuity and sweet.
              I'm jelly, what am I? Muse on it further, I shall return!
              - David Williams (Little Britain)

              1 Reply Last reply
              0
              • RaviBeeR RaviBee

                Memories... (my Mass license plate is VAX-VMS) :cool: Spent 8 very happy years @ Digital (when it was still Digital). /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                G Offline
                G Offline
                Gary Wheeler
                wrote on last edited by
                #23

                Indeed. I used to write entire applications in DCL :-O.


                Software Zen: delete this;

                RaviBeeR 1 Reply Last reply
                0
                • G Gary Wheeler

                  Indeed. I used to write entire applications in DCL :-O.


                  Software Zen: delete this;

                  RaviBeeR Offline
                  RaviBeeR Offline
                  RaviBee
                  wrote on last edited by
                  #24

                  Oh yeah! Remember the DEC Professional? They were kind enough to publish several of my DCL hacks. I recall (with awe) when DCL released with VMS 3.1 first offered the END IF clause. What power! :omg: /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                  1 Reply Last reply
                  0
                  • D Daniel Turini

                    Rick York wrote: I saw little reason for the ++ and -- operators and did not include them You code in C**++** and do not see the need for the ++ operator? :omg::wtf: Yes, even I am blogging now!

                    R Offline
                    R Offline
                    Rick York
                    wrote on last edited by
                    #25

                    No, not in a scripting language that has no concept of objects. __________________________________________ a two cent stamp short of going postal.

                    1 Reply Last reply
                    0
                    • P peterchen

                      exactly my thought - dunno why you were voted down...


                      we are here to help each other get through this thing, whatever it is Vonnegut jr.
                      sighist || Agile Programming | doxygen

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #26

                      I am ALWAYS voted down. Come to the soapbox if you want to find out why :P Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

                      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