﻿# V202\. Explicit conversion from memsize type to 32\-bit integer type\.


> This rule belongs to the "Diagnosis of 64\\\-bit errors" group\\\. The rules in this group are no longer developed and may be disabled in the future\\\. If you use these rules, please \[contact our support team\]\(https://pvs\-studio\.com/en/about\-feedback/\)—we will help you find a replacement or suggest an alternative solution\\\.

It informs about the presence of the explicit integer 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\.

The V202 warning applied to conversions of pointers to 32\-bit integer types before\. Such conversions are rather dangerous, so we singled them out into a separate rule [V205](https://pvs-studio.com/en/docs/warnings/v205/)\.

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\.

```cpp
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\.

```cpp
const unsigned bits =
  unsigned(sizeof(object) * 8); //V202

extern size_t nPane;
 extern HICON hIcon;
BOOL result =
  SetIcon(static_cast<int>(nPane), hIcon); //V202
```

Additional materials on this topic:

1. 64\-bit Lessons\. Lesson 15\. Pattern 7\. [Pointer packing](https://pvs-studio.com/en/blog/lessons/0015/)\.