POLL: Programming style - i++ vs. ++i
-
After a batch of interviews, the second most notable thing is that where both
++i
andi++
are possible, all candidates usedi++
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'sfor(int i=0; i<n; ++i)
, and Vote 1 if it'sfor(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++i is safe there but a bad habit in other places so I stick with i++. Elaine :rose: The tigress is here :-D
-
I use
foreach
. :) Jonathan de Halleux - My Blog -
++i is safe there but a bad habit in other places so I stick with i++. Elaine :rose: The tigress is here :-D
-
++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
-
After a batch of interviews, the second most notable thing is that where both
++i
andi++
are possible, all candidates usedi++
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'sfor(int i=0; i<n; ++i)
, and Vote 1 if it'sfor(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 -
After a batch of interviews, the second most notable thing is that where both
++i
andi++
are possible, all candidates usedi++
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'sfor(int i=0; i<n; ++i)
, and Vote 1 if it'sfor(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 | doxygenpeterchen 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
-
After a batch of interviews, the second most notable thing is that where both
++i
andi++
are possible, all candidates usedi++
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'sfor(int i=0; i<n; ++i)
, and Vote 1 if it'sfor(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 | doxygenStrange 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) -
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
Indeed. I used to write entire applications in DCL :-O.
Software Zen:
delete this;
-
Indeed. I used to write entire applications in DCL :-O.
Software Zen:
delete this;
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 -
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! -
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 | doxygenI 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