[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kstars/unfrozen/kstars/kstars
From:       Jason Harris <kstars () 30doradus ! org>
Date:       2008-07-01 6:09:39
Message-ID: 1214892579.830184.6993.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 826641 by harris:

Interesting-yet-annoying C++ Trivia:

If you declare an enum thusly:

typedef enum { MERCURY, VENUS, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO, 
SUN, MOON } PLANET;

there's *no* guarantee that the integers assigned to each item will be 
consecutive.  They *usually* are, but just for fun, sometimes they aren't!  In my 
case, the first 9 items were assigned consecutive numbers 0-8, and then the MOON 
item was assigned to 12!  

That's the last time I trust g++ to count to 9, I guess...
Argh.

CCMAIL: kstars-devel@kde.org



 M  +1 -1      ksplanetbase.h  


--- branches/kstars/unfrozen/kstars/kstars/ksplanetbase.h #826640:826641
@@ -28,7 +28,7 @@
 
 #include "trailobject.h"
 
-typedef enum { MERCURY, VENUS, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO, SUN, \
MOON, UNKNOWN_PLANET } PLANET; +typedef enum { MERCURY=0, VENUS=1, MARS=2, JUPITER=3, \
SATURN=4, URANUS=5, NEPTUNE=6, PLUTO=7, SUN=8, MOON=9, UNKNOWN_PLANET } PLANET;  
 class QPoint;
 class KSNumbers;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic