read(fd,&y,sizeof(y))

hartwell at Su-Shasta.ARPA hartwell at Su-Shasta.ARPA
Thu Mar 22 07:44:00 AEST 1984


From:  Steve Hartwell <hartwell at Su-Shasta.ARPA>

I think you should curb your dogma, Guy.

I see a degree of cleanness in the basic datatype promotions from small
ints to "generic" ints, and small floats to "generic" floats (that is,
doubles) when passed as parameters, and I believe that that specification
was made with the intention to aid in simplifying compiler implementation
[ and not just because the architecture of the pdp11 demanded it, as
  suggested to me in a previous letter ].
And I see no reason why this concept should not be generalized to
pointers as well.  Passing a character as an argument to a function
without an explicit cast is hardly reckless abandon; K&R say that
chars are members of the int family and are treated that way.  Why should
passing a pointer be any more stringent?  It seems so much more conceptually
clean to me to say that a (foo *) is a member of the pointer family and
give the compiler implementors (and program writers) a break.

That is why I think that null pointers should be represented as NULL,
whose definition is 0 *cast to a pointer to anything you like*; I don't
believe that it should make a difference whether it is a (char *) 0 or
a (struct _iob *)0.

My view is that program control and data management is complex enough
as it is, and if by clustering basic operative groups {ints, floats, pointers}
can free me from cast slavery then I would argue for it.  Fervent
bible-thumping serves no purpose in a discussion which considers the
merits and limitations of the standard(s); we /know/ what it SAYS;
but you certainly hold no patent on its interpretation, or on what
is worth cross-examining.

Steve Hartwell, Stanford



More information about the Comp.unix.wizards mailing list