[Top][All Lists]

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

Re: [avr-gcc-list] avr-gcc printf optimisation ?

From: Colin D Bennett
Subject: Re: [avr-gcc-list] avr-gcc printf optimisation ?
Date: Tue, 16 Dec 2008 22:50:39 -0800

On Wed, 17 Dec 2008 07:58:57 +0200
"Anton James Erasmus" <address@hidden> wrote:

> Hi,
> I have been using my own printf in stead of the printf of
> avr-libc. It is based on some public domain code, which was
> modified to handle the format string in flash. Since it has
> been working fine, I have not switched to the avr-libc
> version. I am not sure when this optimisation actually
> appeared in gcc, since I seldom use printf("Some
> text\r\n").
> I can rename the function, but if one uses printf, then gcc
> warns one when the parameters does not match the format
> string. 

You can get gcc to check printf-type format strings for other functions
using '__attribute__((format(printf, i, j)))' in the declaration.  For
example, the following declares another printf-type function that gcc
will check parameters for:

int my_printf(const char *fmt, ...)
    __attribute__  ((format (printf, 1, 2)));


Attachment: signature.asc
Description: PGP signature

reply via email to

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