namedenums/namedenums.cpp

changeset 136
1c40bb4f8221
parent 135
8b9132fea327
--- a/namedenums/namedenums.cpp	Mon Jul 21 17:14:42 2014 +0300
+++ b/namedenums/namedenums.cpp	Tue Jul 22 02:52:25 2014 +0300
@@ -341,6 +341,10 @@
 
 					if (*cp == '=')
 					{
+						// until I figure out how to deal with the duplicate value issue
+						// I should probably use a map but not today.
+						Error ("cannot have named enums that define enumerator values");
+
 						nenum.valuedefs = true;
 
 						while (*cp != ',' && *cp != '\0')
@@ -414,7 +418,7 @@
 
 				source.append ("const char* Get%sString (%s value)\n"
 					"{\n"
-					"\treturn %sNames[value];\n"
+					"\treturn %sNames[long (value)];\n"
 					"}\n",
 					e.name.c_str(), e.name.c_str(), e.name.c_str());
 			}

mercurial