avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] avr-gcc 3.3 built in function "putchar" "puts"


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] avr-gcc 3.3 built in function "putchar" "puts"
Date: Mon, 14 Apr 2003 23:05:22 +0200 (MET DST)

[Please don't followup to unrelated threads, for threading mail/news
readers, it makes your message appear at the wrong location.]

Larry Barrelo wrote:

>New with the latest Winavr release (avrfreaks) is a compiler complaint
>that I have conflicting types for 'putchar' and 'puts'.
>
>When did these become "built-in functions"?

They are not builtin, but they are reserved by the C standard.  Since
the C standard allows the compiler to substitute code for known
standard functions by something else that behaves identical, it's
always a good idea to adhere to the standard here, and use
non-conflicting names.  One example of such an optimization is that

strlen("foo")

will be replaced by the constant 3, without any run-time overhead,
since the compiler has internal knowledge about how strlen() is
supposed to behave.  If you try to write your own strlen() that
e. g. uses '\xff' as the string terminator, the result is what the
standard would call »undefined behaviour«.

>Regardless, is there a way to keep the compiler quiet about this
>other than changing these routines to "my_putchar" and "my_puts"?

-ffreestanding will turn off any standard library assumptions.  It
will also turn off any optimization like the one above.

If i were you, i'd rather avoid conflicts with the C standard though.
Then you've still got the option to use either -ffreestanding or not,
whatever yields the better code for you.
-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/


reply via email to

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