https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86102

--- Comment #2 from Jonny Grant <jg at jguk dot org> ---
My bad apologies, I pasted the wrong compiler output from older gcc

If I fix that const error in my sample, I get same output as you, with correct
carat.

Could I check - do you mean callnig a function like 

printf("result: %zu %zu %zu\n", value, "test", str);

There is no benefit from displaying 'value'  '"test"' or 'str' ?
Some functions might have 10 arguments.. much clearer to print the name of the
one that is bad I feel :)



<source>: In function 'int main()':

<source>:9:12: error: format '%zu' expects argument of type 'size_t', but
argument 3 has type 'const char*' [-Werror=format=]

     printf("result: %zu %zu %zu\n", value, "test", str);

            ^~~~~~~~~~~~~~~~~~~~~~~         ~~~~~~

<source>:9:12: error: format '%zu' expects argument of type 'size_t', but
argument 4 has type 'const char*' [-Werror=format=]

cc1plus: all warnings being treated as errors

Compiler returned: 1


//gcc -O2 -Wall -Wextra -Wpedantic -o main main.c

#include <stdio.h>

int main (void)
{
    size_t value = 0;
    const char * str = "other";
    printf("result: %zu %zu %zu\n", value, "test", str);

    return 0;
}

Reply via email to