在 2019/1/2 9:19, Óscar Fuentes 写道:
> Valerio Messina via Msys2-users
> <msys2-users@lists.sourceforge.net> writes:
> 
>> #include <stdlib.h>
>> MB_CUR_MAX while it must store a number between 1 and MB_LEN_MAX (that
>> is almost always 16), it is of type 'size_t', so 4 Bytes on 32 bit
>> systems, and 8 Bytes on 64 bit systems. This is valid on Linux.
>>
>> When using mingw it results of type 'size_t' 4 Bytes targeting win32,
>> but of type 'int' 4 Bytes when targeting Win64.
>>
>> This difference between Linux64 and Win64 platforms complicate porting
>> software.
>> Is it a known difference?
> 
> The runtime comes from the mingw-w64 project:
> 
> https://mingw-w64.org/
> 
> Try asking on their mailing list, that's where you can find the people
> that know the answer.
> 


Yes the type of `MB_CUR_MAX` (after being expanded) does not conform to
the C standard but it is what Microsoft people say. Their `MB_CUR_MAX`
macro expands to a function call to these functions [1] which all return
`int`. Refer to their headers for details.

This can be fixed easily by adding a cast in `MB_CUR_MAX` but I doubt
whether there will be any ABI breakage.

[1]
https://docs.microsoft.com/en-us/cpp/c-runtime-library/mb-cur-max-func-mb-cur-max-l-func-p-mb-cur-max-mb-cur-max?view=vs-2017


-- 
Best regards,
LH_Mouse

_______________________________________________
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to