Hi David,
>> 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?
>
> You can declare main like this instead:
>
> void main( void )
> {
> ....
> }
>
> If you compile your code using the -ffreestanding option, then the
> compiler won't complain that main doesn't return an int.
I see that -ffreestanding turns off the builtin functions (i.e.
-ffreestanding implies -fnobuiltin). I tried this combination:
-ffreestanding -fbuiltin
and this does in fact turn the builtin functions back on (at least
printf of a simple string becomes puts).
--
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/Message
Re: [AVR-Chat] Finally, really, actually, starting off with C
2009-01-07 by Dave Hylands