Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] C programming on AVR

2008-03-23 by dlc

Sander Pool wrote:
> Why are printf and malloc bad habits? In your opinion, of course.

Oy!  You've opened a can o' worms right and proper!  Printf is a nasty 
bit of work that is a small OS in and of itself.  It has to dynamically 
restructure itself to handle different print options since there is no 
fixed order or function within its use.  As such it sucks up a bunch of 
memory for very little utility.  Malloc is simply bad because you give 
up control of how memory is being used.  You typically have little 
enough RAM lying about to get what you want done, you don't need 
something else assigning RAM to structures that you can't reuse or 
carefully control!  With embedded programming you must know where all 
your time is being spent and what RAM is being used and where it is 
being used.

DLC

>     Sander
> 
> David Kelly wrote:
>>
>>
>> Not only "allows" but "encourages." Printf() and malloc() come to mind
>> as bad habits that have to be broke to write good 8-bit embedded code.
>>
>> --
>> David Kelly N4HHE, dkelly@HiWAAY.net <mailto:dkelly%40HiWAAY.net>
>> ========================================================================
>> Whom computers would destroy, they must first drive mad.
>>
>> __
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
> 

-- 
-------------------------------------------------
Dennis Clark          TTT Enterprises
www.techtoystoday.com
-------------------------------------------------

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.