RE: not sure where to post this question... bit C++ implementation specific....
"Crosbie Fitch" <[email protected]>
| Newsgroups | gmane.games.devel.general |
|---|---|
| Message-ID | <002101c46409$e2c34db0$2500a8c0@blue500> |
> From: Jorrit Tyberghein > How would that help? In C++ you simply cannot do this: > > int a = 6; > int array[a]; > > It is not possible to allocate arrays with variables (const > or not const). Many apologies for the following hack, but once upon a time it was needed. #if 0 #define CLASS_INT(N) _SClassInt##N #define CLASS_INT_STRUCT(N) typedef char CLASS_INT(N) [N] CLASS_INT_STRUCT(2); CLASS_INT_STRUCT(3); CLASS_INT_STRUCT(4); #undef CLASS_INT_STRUCT #define NUMBER(NN) CLASS_INT(NN) #else #define NUMBER(NN) char [NN] #endif #define _2 NUMBER(2) #define _3 NUMBER(3) #define _4 NUMBER(4) #define INT_(NUM) (sizeof(NUM)) Maybe it could be used again? e.g. int array[INT_(NUMBER(6))]; But, there MUST be a better answer these days eh? Templates perhaps? ------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-general Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU7