enum VARTYPES {mass, momentum, spin}
and I would like to declare an array
double myVars[3];
without resorting to the hardcoded 3, (spin+1), or anything else that relies on the VARTYPES enum not changing.
enum VARTYPES {mass, momentum, spin}
and I would like to declare an array
double myVars[3];
without resorting to the hardcoded 3, (spin+1), or anything else that relies on the VARTYPES enum not changing.
Quote:Original post by dalep
That's one of the nicer little features of Pascal/Delphi - the way you can declare a type that's an array subscripted with an enum. You'd just declare
double myVars[VARTYPES];
actually you'd declare
myVars: array[VARTYPES] of double;
but you get the point. The array is subscripted by VARTYPES. I'm kinda suprised that no other language has duplicated this convenience.
enum{FIRST,SECOND,THIRD,LAST};int array[LAST];array[FIRST] = 1;array[SECOND] = 2;
Quote:Original post by dalep
"LAST", my dear rip-off, is not a type the way VARTYPES is. Its a value in an enum. Which is not quite the same thing. A Pascal type-subscripted array does not require dummy entries like LAST. Its a minor thing.
Quote:
The array is subscripted by VARTYPES. I'm kinda suprised that no other language has duplicated this convenience.
Quote:Original post by dalep
"procedure", "function", "then", "begin" and "end" hundreds upon hundreds of times. oh well ^_^