Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!craig@LOKI.ARPA From: craig@LOKI.ARPA (Craig Partridge) Newsgroups: net.lang.c Subject: Need some examples Message-ID: <299@brl-tgr.ARPA> Date: Tue, 30-Jul-85 13:24:29 EDT Article-I.D.: brl-tgr.299 Posted: Tue Jul 30 13:24:29 1985 Date-Received: Thu, 1-Aug-85 04:59:52 EDT Sender: news@brl-tgr.ARPA Lines: 32 I know this general subject has been hashed over before so please respond to me directly, not to the whole net. If I get enough requests I'll post a summary. There are a variety of funny little problems with using the 0 pointer in C. Recently I have gotten into a debate with a friend about passing a 0 pointer to a function. We agree that given a function declaration like f(ptr) foo *ptr; { [code] } calling f(0) is dangerous. But my friend contends that calling f() with a zero char pointer, e.g. f((char *)0), is safe, because (char *) is the largest pointer, and that he doesn't know of a C implementation that doesn't pass all pointers as the largest possible pointer (ala the way floats always get passed as doubles). I suspect the argument is wrong (and dangerous), but don't have examples of machines on which this trick fails. Anybody got ammunition out there to help my side out? (The question is not just academic, it will affect a C standards document for a project). Thanks, Craig Partridge craig@bbn-loki (ARPA) craig%loki.arpa@csnet-relay (CSNET) {decvax,ihnp4,wjh12}!bbncca!craig (USENET)