update EnumToString comment. Should we assert on an _Invalid value?
This commit is contained in:
@@ -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
|
// iMax+1 is "Invalid". iMax+0 is the NUM_ size value, which can not be converted
|
||||||
// to a string.
|
// 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]) );
|
ASSERT_M( iVal >= 0 && (iVal < iMax || iVal == iMax+1), ssprintf("%i, %i, (%s)", iVal, iMax, szNameArray[0]) );
|
||||||
return *pNameCache[iVal];
|
return *pNameCache[iVal];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user