On Thu, Feb 16, 2006 at 10:54:52AM -0500, Evan wrote:
> I'm confused about you think that's an abuse of switch? That's a valid use
> that's been used for YEARS in C programming, it's nothing new.
Hmm, the value in a case statement must be an integer contant, in C
i.e. the value must be known at compile-time, not evaluated at
run-time:
----t.c---
int main(int argc, char** argv) {
int a = 1;
int b = 2;
int c = 3;
switch (1) {
case a==b:
printf("a==1\n");
break;
case a==c:
printf("a==2\n");
}
printf("done.\n");
}
----
$ gcc t.c
t.c: In function `main':
t.c:7: error: case label does not reduce to an integer constant
t.c:10: error: case label does not reduce to an integer constant
ta,
dave
--
http://david.holroyd.me.uk/
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org