开发者

cannot convert parameter 5 from 'SIZE_T *' to 'size_t *' -- why?

开发者 https://www.devze.com 2023-02-15 17:32 出处:网络
I\'m getting this error when compiling 开发者_如何学Gofor 32-bit.The same file compiles with no errors for 64-bit Windows

I'm getting this error when compiling 开发者_如何学Gofor 32-bit. The same file compiles with no errors for 64-bit Windows

1>c:\project\test.cpp(1317) : error C2664: 'StringCbCopyExW' : cannot convert parameter 5 from 'SIZE_T *' to 'size_t *'

Both SIZE_T and size_t have the same size and sign so what is the difference? Why do I need a cast here? And if the types are different, why is this an error only on 32-bit Windows?


SIZE_T is different from std::size_t. The first is a type #defined in the windows headers, the second is a type defined by your C++ compiler. They are different types.

At least on my system, SIZE_T is a typedef for ULONG_PTR, which is a #define for unsigned long.


what is SIZE_T defined as?

It might be defined as "unsigned int", or uint32_t for backward comaptibility

0

精彩评论

暂无评论...
验证码 换一张
取 消