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

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

Re: [avr-gcc-list] Re: sprintf


From: Daniel O'Connor
Subject: Re: [avr-gcc-list] Re: sprintf
Date: Sat, 28 Feb 2009 10:21:16 +1030
User-agent: KMail/1.10.4 (Linux/2.6.27-11-generic; KDE/4.1.4; i686; ; )

On Saturday 28 February 2009 09:00:50 David Kelly wrote:
> On Fri, Feb 27, 2009 at 10:37:30PM +0100, Vincent Trouilliez wrote:
> > On Fri, 27 Feb 2009 22:10:16 +0100
> >
> > David Brown <address@hidden> wrote:
> > >   sprintf((A_String + i), "%c", 0xff)
> > >
> > > has exactly the same effect as:
> > >
> > >   A_String[i] = 0xff;
> > >   A_String[i + 1] = 0x00;
> > >   delay_about_1000_processor_cycles();
> > >   waste_about_2000_bytes_of_code_space();
> >
> > ROTF ! :-))))
>
> sprintf() only costs 2kB? Sure enough, this little program is 2132 bytes
> after strip:

Depends which vprintf you ask for, see 
http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#ga3b98c0d17b35642c0f3e4649092b9f1

Also, while it IS a pig (relative to the micro flash size and CPU) it is
very powerful and for a lot of applications the speed is not critical.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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