Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#377 C library bug: Modifiers %jd %ju %zu not working

v1.0 (example)
closed-wont-fix
nobody
1
2014-08-13
2014-01-24
argentinator
No

Problem with stdio.h MinGW W64.

The formats "%jd", "%ju", and "%zu" are not working with printf().

Language: C
Version: x86_64-w64-mingw32-gcc-4.7.1.exe (tdm64-1) 4.7.1 (the same with 32 bits)
Compiler: TDM-GCC 4.7.1 64 bit Release. (the same happens with 32 bits)
Compiler options: -std=c99 (or well no options).
IDE: DevCpp 5.5.3.
Target: Console Windows application.
System: Windows 7 64 bit

Code:

#include <stdio.h>
#include <stdint.h>
int main(void) {
    printf("%jd%ju%zu", (intmax_t) 1, (uintmax_t) 1, (size_t) 1);
    return 0;
}

Output:


jdjuzu


Compile LOG:


General: TDM-GCC 4.7.1 64-bit Release
Building Makefile "C:\Program Files (x86)\Dev-Cpp\Makefile.win"
Finding dependencies for file: C:\Program Files (x86)\Dev-Cpp\test_format_j.c
Executing make...
mingw32-make.exe -f "C:\Program Files (x86)\Dev-Cpp\Makefile.win" all
mingw32-make.exe: Nothing to be done for `all'.
Compilation succeeded in 0,62 seconds


Discussion

  • Jonathan Yong
    Jonathan Yong
    2014-01-24

    This will never work since you are using Microsoft's implementation.
    Use mingw_printf directly or define USE_MINGW_ANSI_STDIO to 1 before including stdio.h.

     
  • Jonathan Yong
    Jonathan Yong
    2014-01-24

    • status: open --> closed-wont-fix
     
  • Jonathan Yong
    Jonathan Yong
    2014-01-24

    Closing, not a bug.