[mythtv] C++ style

Derek Atkins warlord at MIT.EDU
Wed Feb 11 16:28:52 EST 2004


Daniel Thor Kristjansson <danielk at cat.nyu.edu> writes:

> Classes are the real reason to prefer pre-increment over post-increment,
> with integers the compiler will figure it out. There is also a backward
> compatibility reason for it. In old school C ++i is defined as a
> pre-increment and i++ is defined as "whatever is fastest" so there is
> no actual post-increment in C. Many compilers including gcc support it
> as a post-increment because that's less surprising, but you might not
> want to depend on that.

This is no longer the case with c99.  According to section 6.5.2.4
(Postfix increment and decrement operators), "The result of the postfix
++ operator is the value of the operand.  After the result is obtained,
the value of the operand is incremented".  So, your interpretation may
have been correct at one point, but it is certainly not correct at
THIS point.

-derek
-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the mythtv-dev mailing list