How do you specify a integer literal as a WORD?

Viewed 121

I have this code:

bool bIsSampleConversationVideo = 
        m_aryWStudentAssignTypeIndex[wItem - 1] == 
        CChristianLifeMinistryDefines::kSampleConversationVideo;

When I compile with code analysis in 64 bit I get the following warning for [wItem - ]:

LNT1000 A sub-expression may overflow before being assigned to a wider type.

When I hover the mouse over the two items I see:

  • wItem is of type WORD
  • 1 is of type int

I know that you can add suffixes to literal numbers, like L etc. but don't find out how to specify a integer literal as a WORD.


It is possible that I have miss-interpreted the warning. Either way, is there a simple resolution to prevent the code analysis warning?

0 Answers
Related