bug in lrint [was: FW: Printing long int in C program under cygwin64]

Steven Penny svnpenn@gmail.com
Fri May 26 05:01:00 GMT 2017


On Thu, 25 May 2017 18:43:58, Steven Penny wrote:
> Uh, have you actually tried this? It doesnt do anything:
> 
>     $ cat alfa.c
>     #define __USE_MINGW_ANSI_STDIO 1
>     #include <stdio.h>
>     int main() {
>       printf("%zi %zu %llu\n", __SIZE_MAX__, __SIZE_MAX__, __SIZE_MAX__);
>     }
> 
>     $ x86_64-w64-mingw32-gcc -Wformat-signedness -o alfa alfa.c

Correcting myself: you need 2 flags to get this working:

    $ x86_64-w64-mingw32-gcc -Wformat -Wformat-signedness alfa.c
    alfa.c: In function ‘main’:
    alfa.c:11:10: warning: format ‘%zi’ expects argument of type
    ‘signed size_t’, but argument 2 has type ‘long long unsigned int’
    [-Wformat=]
       printf("%zi %zu %llu\n", __SIZE_MAX__, __SIZE_MAX__, __SIZE_MAX__);
              ^


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list