Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!sri-spam!sri-unix!hplabs!sdcrdcf!trwrb!aero!venera.isi.edu!lmiller From: lmiller@venera.isi.edu.UUCP Newsgroups: comp.lang.c Subject: Re: Casting NULL again Message-ID: <2019@venera.isi.edu> Date: Fri, 30-Jan-87 12:56:33 EST Article-I.D.: venera.2019 Posted: Fri Jan 30 12:56:33 1987 Date-Received: Sat, 31-Jan-87 20:14:41 EST References: <3859@brl-adm.ARPA> <12211@sun.uucp> Reply-To: lmiller@venera.isi.edu.UUCP (Larry Miller) Organization: Information Sciences Institute, Univ. of So. California Lines: 26 In article <12211@sun.uucp> guy@sun.UUCP (Guy Harris) writes: >>Thanks for your comments on this matter. Unfortunately, most >>of you misunderstood what I wanted. I realize that under some >>machines ints are 16 bits and pointers are 32. I have a MAC and >>thats the case there and I often have to pass parameters as >>(long)NULL to get the right number of bytes passed. >>That's nothing to do with pointers per se,=that's a "problem" of >>dealing with long int parameters. > >The person who claimed that the reason you cast NULL to a particular >pointer type is that pointers to different types might have different >sizes is only partially correct. The *real* reason is that pointers >to different types have different types! Too many C programmers feel >that correct C is anything they can get away with, and too many >programmers get burned by this. > > etc., etc. For what it's worth, I'd like to add my two cents in support of this point of view. Though it's rediculous now, there may come a time when automatic verification of programs is reasonable. Verification is aided by languages with well defined semantics. It is impossible when we use tricks. So as programmers who also give at least lip service to "computer science", we should try to make our programs as formally correct as possible. And as has been repeatedly noted, doing so aids portability, maintainability, etc., etc.