switch/case problem: 'case must be a string or an integral constant'

Thomas Kuehne thomas-dloop at kuehne.cn
Fri Mar 9 03:27:52 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

SirErugor schrieb am 2007-03-09:
> Hi there :)
>
> I'm just doing a basic switch/case like this:
> static final int PONG = 1;
const int PONG = 1;

> ...
> input.msgcode = PONG;
> ...
> switch(input.msgcode)
> {
>      case PONG:
>             ....
>             break;
> }
>
> If I do something like this I get the following error:
> "server.d:189: Error: case must be a string or an integral constant, not PONG"
>
> What do I do?

-----BEGIN PGP SIGNATURE-----

iD8DBQFF8VFrLK5blCcjpWoRAhvrAJ4sO0cl2f/OSqJVvL+soITRZCSkrgCfW8y9
bMkJXF4enfdIIHsO+nBjoqU=
=yMBi
-----END PGP SIGNATURE-----


More information about the Digitalmars-d-learn mailing list