Il 26/08/2016 23.05, Patrick Alken ha scritto:

I believe %zu is part of the C99 standard. I'm not sure how to make it portable for C90 on windows, any ideas?

Yes, it is. Indeed is C99 standard. But Microsoft (and MinGW is using Microsoft runtime library) is not supporting C99, msvcrt.dll is mostly C89. But in recent years, with VS2013 the C99 support improved (as far as I know not supporting %zu) but MinGW is linking against msvcrt.dll (a stone that will never change) and not msvcr120.dll. Then VS2015 supports %zu.

This is a known issue (or feature) of MinGW (both 32 and 64) and the right way to manage it is to define

|-D__USE_MINGW_ANSI_STDIO=1
||
|so as not to use "printf-like" functions from msvcrt.dll, with that definition the "mingw_printf" functions are used instead of using "printf-like" functions.


On portability....

MIcrosoft uses %Iu (I like Italy not lowercase L) for printing size_t , I'd like to test if using %Iu in spio.c is working in MinGW but at the moment I can't.

Anyway if I were you I wouldn't change the code. %zu is C99 standard, MinGW users know (or should know) that the above definition is required, the issue is in Microsoft not following the standard and MS is not in the list of supported platform. My guess is that Cygwin has no issue!

Becasue GSL never (as far as I know) compiled "out of the box" in Microsoft VS20xx I don't see any portability issues! GSL should be "ported" in Microsoft MS by the programmer!

Hope this helps

Max


Reply via email to