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 wagnerj@proaxis.com

Welcome to the world of the "kicking and screaming". No, the world will
end in 2011.5 because I "converted" slightly before you.

'Tis my understanding that SOME compilers require the return statement.
IAR perhaps? My understanding is that gcc does not require it but
tolerates it.

As for variable initialization, I can't provide any information with any
confidence. My reference is the avr-libc documentation and the gas (gnu
assembler) documentation. For gcc tutorial, Smiley has a nice book out
with some of the chapters on line on his website.

Jim Wagner
Oregon Research Electronics

> Yes.. The world probably will end in 2012, brought about in no small
> part by my conversion to C.
>
> I bought an AVR-LIP kit from Deccan, and am using WINAVR to get going.
>
> I have a few questions.
>
> All their examples have main as returning an int.
> Returning a value from main, in a microcontroller is nonsensical, isn't
> it?
> Where would it return that to?
> Why would I want to spend four bytes of RAM on that?
>
>
> Declaring a variable:
> Does C (or Winavr) init a declared variable to some defined state
> ALWAYS, or do I have to?
> I don't mind doing it, and I'm sure that's absolutely safe, but I
> don't want to do un-necessary operations.
> Would the compiler be smart enough to take out a redundant init of a
> variable? (assuming right after declaration)
>
>
> --
>
> "The very powerful and the very stupid have one thing in common. Instead
> of
> altering their views to fit the facts, they alter the facts to fit their
> views... which can be very uncomfortable if you happen to be one of the
> facts that needs altering." Doctor Who, Face of Evil
>

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.