update EnumToString comment. Should we assert on an _Invalid value?

This commit is contained in:
Chris Danford
2007-09-13 04:47:18 +00:00
parent a0732c6256
commit 7a156e73bb
+3
View File
@@ -65,6 +65,9 @@ const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_
// iMax+1 is "Invalid". iMax+0 is the NUM_ size value, which can not be converted
// to a string.
// Maybe we should assert on _Invalid? It seems better to make
// the caller check that they're supplying a valid enum value instead of
// returning an inconspicuous garbage value (empty string). -Chris
ASSERT_M( iVal >= 0 && (iVal < iMax || iVal == iMax+1), ssprintf("%i, %i, (%s)", iVal, iMax, szNameArray[0]) );
return *pNameCache[iVal];
}