read(fd,&y,sizeof y)

hartwell%shasta at sri-unix.UUCP hartwell%shasta at sri-unix.UUCP
Wed Mar 14 12:45:00 AEST 1984


From:  Steve Hartwell <hartwell at shasta>

I don't think this is non-portable.  For a machine which has pointers of more
than one width, the compiler can be expected to widen the shorter ones to
the width of the largest as it is pushed onto the argument list, just as
chars are promoted to ints when pushed.  The called function will know it's
stored that way and shorten it if it needs to before it's used.

So it doesn't matter what the type of "y" is in the read call is or what
the actual width of &y is.  It seems simple to me that there should be only
one width of a pointer on the argument stack [Not necessarily the width of
an int, either].

Steve Hartwell, Stanford University

p.s. this also speaks to the NULL vs. 0 vs. ((char *) 0) issue.



More information about the Comp.unix.wizards mailing list