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

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

Re: [avr-gcc-list] Problem with union


From: Eric Fu
Subject: Re: [avr-gcc-list] Problem with union
Date: Tue, 24 Aug 2004 20:02:35 +1000

Ted Roth Wrote:
 
> You can do that initialization outside of a function, but you'd have to
> do it like this:
> 
>   TwoBytes ThisNodeID = { 1 };
> 
> or more explicitly, like this:
> 
>   TwoBytes ThisNodeID = { .wForm = 1 };
> 
> What you did with
> 
>   ThisNodeID.wForm = 1;
> 
> is not really an initialization, but an assignment operation and you
> can't do operations outside of a function in C, thus the compiler
> warning (the real C gurus on the list can correct me if my understanding
> of this is deficient).
> 
> ---
> Ted Roth
> PGP Key ID: 0x18F846E9
> Jabber ID: address@hidden

Thanks for the explaination. It works great.

Eric Fu




reply via email to

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