(part 29) Han from China answers your C questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George Orwell

    (part 29) Han from China answers your C questions

    What is this?

    Eric said:
    What is this?
    >
    ( char * ) &( ( struct aStruct * ) 0 )
    That looks like either someone's poor coding or someone's poor
    pasting for an implementation of offsetof() from stddef.h. The
    (char *) leads me to think that there's plenty of missing context,
    so post the surrounding code, and we'll be happy to jerk ourselves
    off analyzing the code for you and telling you why it won't work on
    the control system for your Tomahawk missile.

    For what it's worth,

    ((size_t) &((TYPE *)0)->MEMBER)

    is a common implementation of offsetof() on systems that allow it.

    Yours,
    Han from China

    Il mittente di questo messaggio|The sender address of this
    non corrisponde ad un utente |message is not related to a real
    reale ma all'indirizzo fittizio|person but to a fake address of an
    di un sistema anonimizzatore |anonymous system
    Per maggiori informazioni |For more info


Working...