Viva64 Send comments on this topic.
V202. Explicit type conversion. Type casting from memsize to 32-bit

Glossary Item Box

This warning may be shown if you use the Find incorrect explicit type conversion mode. It informs about the presence of the explicit memsize type conversion to 32-bit type which may hide one of the following errors: V103, V107, V110. You may see the given warnings list to find out the cause of showing the warning message V202.

Keep in mind that most of the warnings of this type will be likely shown on the correct code. Here are some examples of the correct and incorrect code on which this warning will be shown.

The examples of the incorrect code.

  CopyCode image Copy Code
size_t n;
...
for (unsigned i = 0; i != (unsigned)n; ++i) {   //V202
  ...
}
UINT_PTR width, height, depth;
...
UINT arraySize = UINT(width * height * depth);   //V202

The examples of the correct code.

  CopyCode image Copy Code
const unsigned bits = unsigned(sizeof(object) * 8); //V202
extern size_t nPane;
extern HICON hIcon;
BOOL result = SetIcon(static_cast(nPane), hIcon);

See also:

memsize type

limitations of the analyzer Viva64

implicit type conversion

explicit type conversion