C _ jak rozepsat řádek
Miroslav Draxal
evik na volny.cz
Sobota Duben 27 12:18:34 CEST 2013
Dobrý den
Mějme
char MenuPolozkaSet;
typedef union {
char value;
struct {
unsigned Bit0 : 1;
unsigned Bit1 : 1;
unsigned Bit2 : 1;
unsigned Bit3 : 1;
unsigned Bit4 : 1;
unsigned Bit5 : 1;
unsigned Bit6 : 1;
unsigned Bit7 : 1;
} Bits;
struct {
unsigned val : 7;
unsigned bit_ : 1;
} ProlnutiPauza;
struct {
unsigned Mesic : 5;
unsigned AutoOnOff : 1;
unsigned EndProgram : 1;
};
} _ProgramEEprom;
(*((_ProgramEEprom*) & MenuPolozkaSet)).EndProgram = 1; // tohle je OK
Pokud bych to chtěl rozepsat přes fyzický ukazatel
_ProgramEEprom *pProgEEpr = (_ProgramEEprom*) &MenuPolozkaSet;
*pProgEEpr.EndProgram = 1;
To hází chybu
MenuKey.c:261: error: struct/union required
MenuKey.c:261: error: illegal conversion between types
Což asi chápu, ale jak to napsat. Snažím se tomu přijít na kloub. V těch
pointerech plavu.
__________ Informace od ESET NOD32 Antivirus, verze databaze 8272 (20130426)
__________
Tuto zpravu proveril ESET NOD32 Antivirus.
http://www.eset.cz
------------- další část ---------------
HTML příloha byla odstraněna...
URL: <http://list.hw.cz/pipermail/hw-list/attachments/20130427/80479ff4/attachment.htm>
Další informace o konferenci Hw-list