c++ switch?

Topics NOT related to EQ2 or the emulator project.

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

c++ switch?

Post by John Adams » Fri Jul 17, 2009 11:27 am

Kinda exposing my noobness a little... This is kinda a rhetorical question, cuz I actually googled it and discovered...

C++'s "switch(var)" can only use int constants? How lame!!

I was trying to check item_type...

Code: Select all

					switch(item_type)
					{
						case "Normal":
							// stuff
							break;
						case "Armor":
							// stuff
							break;
						case "Spell":
							// stuff
							break;
					}
and being yelled at that "error C2051: case expression not constant" :( :(

I know I ran into this before, but forgot. So, just venting. Back to if/then/else blah...

I can do this in PHP gdi!! ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests