We have

typedef struct {
        int    i;
        int    j;
        ...
} testType;
testType * xP;

Then allocate memory for xP, assign xP->i, etc.

QUESTION. Is it always legitimate to reference xP->i by "*((int *) xP)"?

NOTE. "i" is the very first item in the structure

EXAMPLE. This happens in FrmGetWindowHandle() via WinGetWindowHandle().

I would like to know if this legitimate according to the specification of C
and if it is hardware independent. My guess is that it is OK but I would like
to be reassured and I would even appreciate pointers [no pun intended] for
it.

/PaulN

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to