structures in C

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

  1. gk123987

    gk123987 New Member

    Joined:
    Sep 9, 2008
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    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

    Joined:
    Sep 9, 2008
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    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

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice