Another pointer size problem

L.Marshall lfm at ukc.UUCP
Wed Feb 22 18:35:28 AEST 1984


Another place where pointer sizes can screw you up is in the parameters
to system calls. How many times have you written :

    struct X y;
    read(fd, &y, sizeof(y));

or something similar? This of course *WRONG* and should be :

    read(fd, (char *) &y, sizeof(y));

but how often do you write the coercion? If you had a PERQ (or a PRIME
or a Honeywell...) you would do it all the time (most of the utilities
do it none of the time). So its not just NULL vs 0, at all - let's hear
it for coercions (or do I mean casts?).

  Lindsay F. Marshall
    uucp : ...!(mcvax,vax135)!ukc!lfm
    ARPA : Lindsay_Marshall%NEWCASTLE at MIT-MULTICS
    post : Computing Laboratory, U of Newcastle upon Tyne, U.K.
           +44 - 632 - 329233 xtn 212



More information about the Comp.unix.wizards mailing list