dynadec.com

dynadec user support forums
It is currently Wed Sep 08, 2010 4:26 pm

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Using enum in switch
PostPosted: Thu Mar 04, 2010 9:44 am 
Offline

Joined: Thu Feb 04, 2010 9:15 am
Posts: 2
Hi,

It would be nice to be able to use enums in switch case statements. It seems to me that only ints can be used for the moment.

For example:
Code:
enum e = {TEST1, TEST2};
int i = TEST1;
switch (i)
{
   case TEST1: cout << "first" << endl; break;
   case TEST2: cout << "second" << endl; break;
}

gives the following error:
Code:
test.co[5]::syntax error, unexpected ID, expecting TTINT

Casting the enum as an int does not help.


Top
 Profile E-mail  
 
 Post subject: Re: Using enum in switch
PostPosted: Tue Apr 06, 2010 7:55 am 
Offline

Joined: Mon Sep 07, 2009 3:44 am
Posts: 22
Dear Nada,
switch instruction for enumerated types is now available in Comet 2.1


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group