cannot convert parameter 5 from 'SIZE_T *' to 'size_t *' -- why?
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 #define
d 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
精彩评论