Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Finally, really, actually, starting off with C

2009-01-07 by David VanHorn

>   Global and static variables will always be auto-initialized to zero
> (according to the docs I've read), you'll need to initialize locals
> yourself if you care about their initial state (which you should).  The
> compiler will not remove an unnecessary init.  You are correct, doing it
> yourself will use up code space.

While I was waiting, I asked one of the software guys here during lunch.
He assures me that GCC does not init variables automatically.
It allocates space for them, but does not init unless the init is
written by me into the declaration as:

char i=0;

I left my K+R at home..
Embedded C and the Atmel AVR says that "Global variables are TYPICALLY
(caps mine) cleared when main is started.

"typically" does not leave me with a warm fuzzy feeling....

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.