<snip>
> Error: parse error before theChr
>
> case keyDownEvent: { // Without this brace and matching closing brace
>                      // I get compile errors on the next statement.
>     Char    theChr = event->data.keyDown.chr;
</snip>

Declaring a new variable must be done at the beginning of a new scope in C.
Were not in C++ anymore Toto...   :)  The addition of the braces creates a
new scope and therefore makes the declaration valid.  I do this all the time
in switch statements.

-Paul

PS: now that I think of it, you can't do in in C++ either.  The declaration
would be there in one case but not the others so what would the compiler do
after the switch?

Reply via email to