Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!ius2.cs.cmu.edu!edw From: edw@ius2.cs.cmu.edu (Eddie Wyatt) Newsgroups: comp.lang.c,news.software.b Subject: Re: passing NULL to functions Message-ID: <1144@ius2.cs.cmu.edu> Date: Tue, 5-May-87 21:27:58 EDT Article-I.D.: ius2.1144 Posted: Tue May 5 21:27:58 1987 Date-Received: Sat, 9-May-87 00:39:30 EDT References: <150@sds.UUCP> <1129@ius2.cs.cmu.edu> <5804@brl-smoke.ARPA> <728@sdchema.sdchem.UUCP> Organization: Carnegie-Mellon University, CS/RI Lines: 28 Xref: mnetor comp.lang.c:2084 news.software.b:598 Someone suggested that the 'type' argument to the macro definition #define alloc(type) ((type *) malloc(sizeof(type))) should have parentheses around it. Well consider the macro expansion of x = alloc(int *); Currently the expansion is x = ((int * *) malloc(sizeof(int *))); If the 'type' argument is parenthesized then it would expand to x = (((int *) *) malloc(sizeof(int *))); which is syntactically incorrect (or at least the SUN compiler says it is). Also I've added the macro definition : #define NULLPTR(type) ((type *) 0) I know all of you out there will be relieved to hear that :-). -- Eddie Wyatt e-mail: edw@ius2.cs.cmu.edu