Actually... (i >= 0 && i < m_Size) is true for i = 0 .. N-1 (i < 0 && i >= m_UserMessages.Count()) is true for items outside i = 0 .. M-1
They are correct as written if m_Size equals m_UserMessages.Count(), the first is meant to range check, and the second is meant to handle items outside the valid range. If GetUserMesageInfo is throwing an exception and is meant to return false instead, it's another point in the logic that's a problem (like m_Size not actually equaling m_UserMessages.Count()), not the choice of operators. Karl -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Spencer "voogru" MacDonald Sent: Sunday, January 16, 2005 9:40 AM To: hlcoders@list.valvesoftware.com Subject: RE: [hlcoders] Minor bug with GetUserMessageInfo. Yeah, I guess so. Though the CUserMessages::IsValidIndex function does the same check, but does if(i >= 0 && i < m_Size). Either way, one of these is wrong, because the GetUserMessageInfo should be returning false when I try to get the information for an index that doesn't exist. -----Original Message----- From: Karl "XP-Cagey" Patrick [mailto:[EMAIL PROTECTED] Sent: Sunday, January 16, 2005 11:20 AM To: hlcoders@list.valvesoftware.com Subject: RE: [hlcoders] Minor bug with GetUserMessageInfo. If index 0 is valid (which the first check indicates is true), N items would be in indices 0 through N-1 and the original check is correct. > "if ( index < 0 || index >= (int)m_UserMessages.Count() )" > Shouldn't this be: > "if ( index < 0 || index > (int)m_UserMessages.Count() )" > Or am I mistaken? > Thanks. > - voogru. _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders