Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcnc!gatech!hao!ames!ucbcad!ucbvax!sdcsvax!sdchem!tps From: tps@sdchem.UUCP (Tom Stockfisch) Newsgroups: comp.lang.c,news.software.b Subject: Re: passing NULL to functions Message-ID: <728@sdchema.sdchem.UUCP> Date: Mon, 4-May-87 16:07:17 EDT Article-I.D.: sdchema.728 Posted: Mon May 4 16:07:17 1987 Date-Received: Tue, 5-May-87 05:21:58 EDT References: <150@sds.UUCP> <1129@ius2.cs.cmu.edu> <5804@brl-smoke.ARPA> <4724@utcsri.UUCP> Sender: news@sdchem.UUCP Reply-To: tps@sdchemf.UUCP (Tom Stockfisch) Organization: UC San Diego Lines: 29 Xref: mnetor comp.lang.c:2055 news.software.b:592 In article <4724@utcsri.UUCP> greg@utcsri.UUCP (Gregory Smith) writes: >>In article <1129@ius2.cs.cmu.edu> edw@ius2.cs.cmu.edu (Eddie Wyatt) writes: >>>#define alloc(type) ((type *) malloc(sizeof(type))) >...problem...is that (type *) is not always a >cast to pointer to type: e.g. int (*)() means pointer to func returning int, >but ( int (*)() * ) means you get a syntax error. > >There is no cure for this; it is a result of C's bass-ackward type syntax. >Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg There is a workaround, but you might not like it: # define palloc( ptype ) ( (ptype)malloc( sizeof( *(ptype) ) ) ) now to get a int (*)() you must do palloc( int (**)() ) || Tom Stockfisch, UCSD Chemistry tps%chem@sdcsvax.ucsd.edu or sdcsvax!sdchem!tps