Commit ed89882
authored
stupid change to avoid compiler warning
**Warning**
```
Warning C4244 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data
with
[
_Ty=int
]
and
[
_Ty2=VM::u8
] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\utility 247
```
**Explanation**
The warning suggests that converting between these types (i.e., from DWORD to u8) may cause data loss since DWORD is 32-bit and u8 is only 8-bit.
**Solution**
All the values you're assigning to the u8 type are valid and will fit within uint8_t. Therefore, casting them as static_cast<u8> will work fine to supress the MSVC compiler warning without any data loss:
- The first value, 6, is well within the range of uint8_t (0-255).
- The rest of the values (7, 8, 10, 11) also fit within the valid range of uint8_t.
By explictly casting the values to "u8" (which is an alias for uint8_t) during initialization, we make it clear that we're aware of the conversion to the compiler.1 parent 402ae6d commit ed89882
1 file changed
Lines changed: 22 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1982 | 1982 | | |
1983 | 1983 | | |
1984 | 1984 | | |
1985 | | - | |
1986 | | - | |
1987 | | - | |
1988 | | - | |
1989 | | - | |
1990 | | - | |
1991 | | - | |
1992 | | - | |
1993 | | - | |
1994 | | - | |
1995 | | - | |
1996 | | - | |
1997 | | - | |
1998 | | - | |
1999 | | - | |
2000 | | - | |
2001 | | - | |
2002 | | - | |
2003 | | - | |
2004 | | - | |
2005 | | - | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
2006 | 2006 | | |
2007 | 2007 | | |
2008 | 2008 | | |
| |||
10293 | 10293 | | |
10294 | 10294 | | |
10295 | 10295 | | |
10296 | | - | |
| 10296 | + | |
0 commit comments