Page 1 of 1

PostPosted: Wed Mar 07, 2001 9:36 am
by merlinman
I started using pocketc recently my first poject being yet another "snake" clone. I read the language reference and the base pocketc language is very much like c itself (which I know very well).

I tried to check which hardkey the user had pressed in my main gaming loop using the standard switch-case statement. It doesn't work. I created a test program with the lowest possible denominators nessesary to make a switch-case statement and it still didn't compile. Why not? The PocketC langauge reference makes mention of it.

If it's not inplemented, why isn't it: it's one of the most usefull built in functions although admittedly it's just a "convenience" function and not vital.


PostPosted: Wed Mar 07, 2001 12:29 pm
by Vilmos
Sorry it is back to IF, ELSE, rinse, repeat.


PostPosted: Wed Mar 07, 2001 2:55 pm
by jstadolnik
In C, switch-case constructs usually get implemented as if-else-if structures anyhow.

There are some special optimized case-switch cases, but you can pretty much fake them out in PocketC. Check out the optimization post I made in the Knowledge Base section. Specifically look at the "translate", "function select", and "block select" cases. They are all faster than traditional if-else constructs.