Switch statement with char[] strange ?

DMINATOR DMINATOR_member at pathlink.com
Mon Jul 3 12:33:51 PDT 2006


Hi

I am only learning D , but I am getting strange result. 
A small part of the code:

switch( "df" )        //Line 64 - error when running
{
case "v ":
break;
case "vt":
break;
case "vn":
break;
case "f":
break;			
}

Gives me this warning message:
warning - mesh.d(64): switch statement has no default
warning - mesh.d(64): statement is not reachable

and when I run it, I get:
Error: Switch Default mesh(64)

--------------------------
Although when I change it to:

switch( "df" )
{
case "v ":
break;
case "vt":
break;
case "vn":
break;
case "f":
break;
default:
}

- it doesn't give any warning or error message at all.

---------------

I tested it with the latest version 1.062

Is this really how it should be ?





More information about the Digitalmars-d-learn mailing list