RE: [GD-General] not sure where to post this question... bit C++ implementation specific....
Brought to you by:
vexxed72
From: Richard F. <gd...@th...> - 2004-07-07 08:49:22
|
You've got to admit this is a bit of a stinker, and i can't see why the c++ langauge cannot cope with this simple premise. At the moment, the best compromise we can come up with is to #ifdef VALUE #error#else#define VALUE 12.5f#endif ... do stuff with the constant ... #undef VALUE we've got a good thing going on about not polluting the namespace, and #defines can wreak havok on anything that hits them. ------------------ On the other hand I may be talking complete drivel. ------------------ > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Jorrit Tyberghein > Sent: 07 July 2004 09:17 AM > To: gam...@li... > Subject: Re: [GD-General] not sure where to post this > question... bit C++ implementation specific.... > > > Richard Fabian wrote: > > >its a bit C++ specific, but does anyone know of a way of getting the > >"meaning" of this to compile... > > > >const float ropeLength = 12.5f; > >const float knotSpace = 3.3f; > >int array[ ropeLength / knotSpace ]; > > > >... its sorta meaning we have to break our own coding > guidlines.... (no > >#defines unless truly necessary) > > > > > > > Well using #define is one way. > > The only other way is using allocation: > int* array = new int[ropeLength / knotSpace]; > But then you must remember to delete[] it later. > > Greetings, > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & > Training. Attend Black Hat Briefings & Training, Las Vegas > July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=557 > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |