C99

GCC does not include a C runtime library. This is supplied by the platform. The MinGW port of GCC uses Microsoft's original (old) Visual C runtime, MSVCRT, which was targeted by Microsoft Visual Studio 6 (released in 1998).

C99 is a standard which did not exist when MSVCRT was created. MSVCRT seems to conform to C89 (mostly). Also note that MSVCRT hasn't changed for many years and probably will not change in the future. Newer versions of Visual Studio use newer runtimes, but these are not always supplied with the operating system or freely downloadable, which makes their use with Open Source software difficult.

Because MinGW relies on MSVCRT, it has many of the same limitations and quirks with compatibility as Visual Studio 6. You should assume that MinGW applications cannot rely on C99 behaviour, only on C89. For example, the newer format characters in printf like %a and %ll are not supported, although there exists a workaround for %ll.

MinGW developers have tried to provide some of these functions in an additional library named mingwex (or more precisely: libmingwex). However this is far from complete. Chances are it never will be. This is most likely true for e.g. printf because it is not merely a matter of adding support for %a but it would require to completely replace all of the existing printf functionality. Unless someone provides code that does the job (see submitting patches elsewhere in this Wiki) it won't happen. Unfortunately using glibc is not an option because of licence issues (possibly discussed elsewhere in this Wiki, likely on the mingw-users list and definitely on the mingw-dvlpr list).

46725 reads

This wiki is not a forum for discussion of usage issues. Please use the mingw-users@lists.osdn.me list instead.We do not allow creation of comments by anonymous or untrusted users, on any page.&nbsp