[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Problem with union
From: |
gouy yann |
Subject: |
Re: [avr-gcc-list] Problem with union |
Date: |
Mon, 23 Aug 2004 17:10:25 +0200 (CEST) |
Hello,
if you want to initialize your union out of any
function, you should write:
TwoBytes ThisNodeID = { .wForm = 1 };
In a function, your code is correct.
regards.
Yann
--- Eric Fu <address@hidden> a écrit :
> I have a problem to use union in avrgcc. When I
> compile the following,:
> typedef union TwoBytes
> { /* unsigned 16 bit type for 8 & 16 */
> word wForm; /* bit accesses: 16 bit var.wForm
> */
> struct
> { /* 8 bit var.byForm.High/Low */
> byte High;
> byte Low;
> }byForm;
> }TwoBytes;
>
>
> TwoBytes ThisNodeID;
> ThisNodeID.wForm = 1;
>
> I get compiling error:
>
> error: parse error before '.' token
>
> What Did I do wrong?
>
> Thanks.
>
>
> Eric Fu
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
>
=====
Vous manquez despace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour
dialoguer instantanément avec vos amis. A télécharger gratuitement sur
http://fr.messenger.yahoo.com