Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!seismo!mimsy!eneevax!umd5!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.UUCP Newsgroups: comp.lang.c,news.software.b Subject: Re: passing NULL to functions Message-ID: <5804@brl-smoke.ARPA> Date: Mon, 27-Apr-87 17:53:13 EDT Article-I.D.: brl-smok.5804 Posted: Mon Apr 27 17:53:13 1987 Date-Received: Wed, 29-Apr-87 01:14:05 EDT References: <150@sds.UUCP> <1129@ius2.cs.cmu.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 19 Xref: utgpu comp.lang.c:1867 news.software.b:538 In article <1129@ius2.cs.cmu.edu> edw@ius2.cs.cmu.edu (Eddie Wyatt) writes: > Are you saying that you are not guarenteed sizeof(char *) == sizeof(int *) >sizeof(long *) == sizeof(whatever *)? Yup. Consider a word-addressed machine (no byte addressing), for example a 16-bit one to make it likely that there simply aren't any spare address bits. To select a byte within a word you'll have to use more than 16 bits, so a (char *) would probably be 32 bits while an (int *) would probably be 16. Although I made up this example, there in fact are C implementations using different sizes for different pointer types. I think Prime or DGC do.. >#define alloc(type) ((type *) malloc(sizeof(type))) Yup, although you might want one more set of () around the first `type'. >#define mfree(x) free(x) More convenient is free((char *)(x)) /* (void *) if supported */