1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

structures in C

Discussion in 'C' started by gk123987, Nov 12, 2008.

  1. gk123987

    gk123987 New Member

    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 ?
     
  2. gk123987

    gk123987 New Member

    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.
     
  3. xpi0t0s

    xpi0t0s Mentor

    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.
     

Share This Page