[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] no compiler warnings from printf_P?

From: Martin Stejskal
Subject: Re: [avr-chat] no compiler warnings from printf_P?
Date: Wed, 18 Mar 2015 07:50:35 +0900

I think there is good reason, why AVR in default work with int instead of unsigned long (RAM bit wide). If you do not like this warning, just explicitly retype this constant.
Reason, why warning is not in second case, is fact, that flash is 16bit wide,  so it is good reason to use 16 bit values, right? It made implementation easier.

On 18 Mar 2015 03:31, "Britton Kerin" <address@hidden> wrote:
I notice that this:

        printf ("should be long unsigned: %lu\n", 42);

generates a nice warning:

     one_wire_slave.c:358:9: error: format ‘%lu’ expects argument of
type ‘long unsigned int’, but argument 2 has type ‘int’
              printf ("should be long unsigned: %lu\n", 42);
     cc1: all warnings being treated as errors

but this:

        printf_P (PSTR ("should be long unsigned: %lu\n"), 42);


Might it be possible to make printf_P generate that sort of warning
also by adding a function attribute?


AVR-chat mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]