[comp.lang.perl] aligment problem in doio.c

marc@athena.mit.edu (Marc Horowitz) (05/22/91)

in doio.c, line 1403:

    fd = accept(fileno(gstio->ifp),buf,&len);

buf is declared as extern char buf[1024], and the second arg is a
struct sockaddr *

On my ansi system with prototypes (using RT hc2.1y), I get an error
from the compiler.  It was pointed out to me that you can't depend on
the alignment of the char array to work for a structure.  Actually, we
know what's in there, so it shouldn't matter, but still, it can be
considered an error by the compiler.  Since you str_nset the pointer
value of buf, I'm not sure what the solution is.  For now, I stuck a
cast in so I could build it.

		Marc