Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!seismo!nbires!fred!nbisos!zog From: zog@nbisos.UUCP Newsgroups: comp.lang.c Subject: Re: NULL pointers as arguments Message-ID: <148@nbisos.NBI.COM> Date: Wed, 29-Apr-87 10:26:53 EDT Article-I.D.: nbisos.148 Posted: Wed Apr 29 10:26:53 1987 Date-Received: Fri, 1-May-87 06:57:39 EDT References: <1130@ius2.cs.cmu.edu> Reply-To: zog@nbisos.UUCP (Chris Herzog) Distribution: na Organization: NBI Boulder, CO Lines: 33 In article <1130@ius2.cs.cmu.edu> edw@ius2.cs.cmu.edu (Eddie Wyatt) writes: > > It seems to me that the problems of having foo(NULL) be correct on >whatever machine you are working on could be taken care of by >having pointer arguements aways be type coerced into whatever the >largest pointer type is on the machine (in cases presented to >me that is char *). This could be done as part of the language >definition just as the float parameter are typed coerced into >doubles. This is NOT correct ! The fact that floats are passed as doubles is supported by the fact that the compiler knows enough to coerce back when the called function picks up the parameter. It's still your responsibility to pass the correct types. The main thrust here with pointers is that different types of pointers can have COMPLETELY different representations. Coercion to a common type is not desireable. All of these problems would go away if people would cast NULL to the proper value. "What about existing code which assumes .... ?" Tough ! It's wrong ! We don't need to change the language definition to support junior programmers. If you can't use a simple tool like lint, then step aside and let someone who really cares do the task. I'm so sick of all of the exceptions being made to support and promote mediocrity ! Chris Herzog