Menu

Format specifier for uint64_t

Help
csr18
2011-03-10
2013-06-06
  • csr18

    csr18 - 2011-03-10

    Hi,

    Pasted below is a small piece of code I am having trouble with when I use -ansi to compile it. This works fine with mingw32. Would appreciate any suggestions on how to fix this. I am using gcc-4.5.0

    <pre>
    $ cat test.c
    #include <stdio.h>
    #include <stdint.h>

    int main() {
            uint64_t foo = 5;
            fprintf(stderr, "VC: foo=%llu\n", foo);
            return 0;
    }

    Command line used:

    gcc -ansi -pedantic -Wall test.c

    Warnings:

    test.c: In function 'main':
    test.c:6:2: warning: unknown conversion type character 'l' in format
    test.c:6:2: warning: too many arguments for format
    </pre>

     
  • Jonathan Yong

    Jonathan Yong - 2011-03-11

    I don't there are 64bit types for ANSI, so %llu might make little sense.

    In any case, you should be using %I64u if using msvcrt printf family.

     

Log in to post a comment.