Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17925

size_t in Visual Studio 2019 32-bit vs 64-bit

$
0
0

Does anyone know why the following code would compile as is in Visual Studio 2019 in 64-bit, but not in 32-bit when compiling as C? I suspect a quirk in the compiler, but would like to rule out anything I'm missing.

(Note that I know I can include for example stddef.h to get the definition of size_t, I'm more interested in why it would work in 64-bit)

int square() {
    size_t i = 5;
    return (int)i;
}

See the following links:

https://godbolt.org/z/DMR9z5

vs

https://godbolt.org/z/QnsTi3


Viewing all articles
Browse latest Browse all 17925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>