Menu

#509 C99 'z' format modifier not implemented correctly

v1.0 (example)
closed-works-for-me
nobody
None
3
2015-11-21
2015-11-21
No

The C99 'z' format modifier does not appear to be implemented correctly.

A simple example to demonstrate...

#include <stdio.h>

int main(const int argc, const char* argv[]) {

  printf("%zu\n", (size_t) -1);

  return 0;
}

The expected would normally be,

18446744073709551615

for Windows 64bit.

The actual output is,

zu

Discussion

  • Kai Tietz

    Kai Tietz - 2015-11-21
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     The C99 'z' format modifier does not appear to be implemented correctly.
    
     A simple example to demonstrate...
    
    • status: open --> closed-works-for-me
     
  • Kai Tietz

    Kai Tietz - 2015-11-21

    Hi Jason,

    the behavior you see here is absolutely that one to be expected. By default mingw-w64's crt-headers are providing MS' variant of printf/scanf routines, which are indeed no compliant to gnu-ish variant you are testing here.

    Nevertheless mingw-w64 provide a way to make use of the gnu-ish C99 printf/scanf routines, You either have to include libstdc++'s config-header (or one of its STL headers) it provides, or to make sure that the macro '__USE_MINGW_ANSI_STDIO' is defined with value '1' (please before including any c-runtime headers).

    Hope this helps. I close this bug as works for me.

     

Log in to post a comment.