lovecreatesbea...@gmail.com wrote On 04/04/07 10:50,:
Quote:
I read `Advanced Programming in the UNIX Environment, 2nd ed.'. In
section 16.3.2, the book says that variables type struct sockaddr_in;
and/or struct sockaddr_in6; will be cast explicitly to variables type
struct sockaddr; Is this safe? Or will these casts between different
structs result in object slices? see casts at line 6 & 9 for example:
>
struct sockaddr add1, *add2; /*see struct declarations below*/
struct sockaddr_in add_in;
struct sockaddr_in6 add_in6;
void *p;
>
add1 = (struct sockaddr) add_in; /*LINE 6*/
[...]
Are you sure you have reproduced the code accurately?
A conforming C compiler is required to emit a diagnostic
for your "LINE 6," which I suspect is missing a few
asterisks and ampersands. Please try again, or confirm
that the code you've posted is accurate (in which case,
it isn't C).
--
Eric.Sosman@sun.com