Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   structures in C (http://www.go4expert.com/forums/structures-in-c-t15116/)

gk123987 12Nov2008 13:17

structures in C
 
admac_status = ADMAC.ADMATE0.BYTE;
ADMAC.ADMATE0.BYTE = (U8)~(HWI_SPI_ADMAC_RSPIB_MASK);
(void)ADMAC.ADMATE0.BYTE;

what is the need for the void typecasting ?

gk123987 12Nov2008 15:33

Re: structures in C
 
Note: ADMAC is a structure with one of its elt as ADMATE0 which is also a structure having BYTE as one of its union elt.

xpi0t0s 12Nov2008 15:51

Re: structures in C
 
My guess is that the cast is there to suppress a warning. The statement has no effect (which could be what the warning would be if the cast were removed). You would need to ask the original programmer why that line is there; it seems pointless to me.


All times are GMT +5.5. The time now is 16:52.