www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

D - documentation bug?: i++

↑ ↓ ← "Georg D." <georg nospam.net> writes:
hello,

in various documentation texts there is "for (int i = 0; i < _something_;
i++)".
why i++? I think it should be ++i, no metter how good optimizer we have.

regards,
Georg
Dec 20 2002
↑ ↓ Evan McClanahan <evan dontSPAMaltarinteractive.com> writes:
Georg D. wrote:
 hello,
 
 in various documentation texts there is "for (int i = 0; i < _something_;
 i++)".
 why i++? I think it should be ++i, no metter how good optimizer we have.
 
 regards,
 Georg

++i and i++ both have valid and different semantic meanings. Both are allowed in D. I don't see what difference it makes which one you use in a loop. Evan
Dec 21 2002
↑ ↓ → "Walter" <walter digitalmars.com> writes:
"Evan McClanahan" <evan dontSPAMaltarinteractive.com> wrote in message
news:au25pi$2nsb$1 digitaldaemon.com...
 in various documentation texts there is "for (int i = 0; i <


 i++)".
 why i++? I think it should be ++i, no metter how good optimizer we have.

allowed in D. I don't see what difference it makes which one you use in a loop.

Since for that use, the same code will be generated for either, which you use is purely a matter of personal taste.
Dec 27 2002