From 7a156e73bb95301ec329e3a43323523de815db97 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 13 Sep 2007 04:47:18 +0000 Subject: [PATCH] update EnumToString comment. Should we assert on an _Invalid value? --- stepmania/src/EnumHelper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stepmania/src/EnumHelper.cpp b/stepmania/src/EnumHelper.cpp index ad56b67cd7..fa2111912f 100644 --- a/stepmania/src/EnumHelper.cpp +++ b/stepmania/src/EnumHelper.cpp @@ -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]; }