Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site uiucdcsb Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcsb!kenny From: kenny@uiucdcsb.CS.UIUC.EDU Newsgroups: net.lang.c Subject: Re: NULL ROUTINE POINTERS Message-ID: <139200018@uiucdcsb> Date: Tue, 3-Dec-85 15:01:00 EST Article-I.D.: uiucdcsb.139200018 Posted: Tue Dec 3 15:01:00 1985 Date-Received: Fri, 6-Dec-85 06:54:40 EST References: <139@brl-tgr.ARPA> Lines: 42 Nf-ID: #R:brl-tgr.ARPA:139:uiucdcsb:139200018:000:1064 Nf-From: uiucdcsb.CS.UIUC.EDU!kenny Dec 3 14:01:00 1985 /* Written 7:08 pm Nov 27, 1985 by jeff@isi-vaxa.arpa in uiucdcsb:net.lang.c */ /* ---------- "NULL ROUTINE POINTERS" ---------- */ After all the talk about null object pointers on machines with non-zero null addresses, how would you portably define a null routine pointer?: Assume that the routine returns a short, - The following don't seem to work: #define NULLROUTINE ((short *()) 0) #define NULLROUTINE ((short *) 0()) And: #define NULLROUTINE ((short *0)()) or #define NULLROUTINE ((short)(*0)()) If all of the above make no sense...Then what? Jeff /* End of text from uiucdcsb:net.lang.c */ To make a cast, write a (fully-parenthesized) declaration of one item of the desired type, and then take out the name. So, if you want a pointer to a function returning short, you might say short (*pfs) (); To cast 0 to this type, it's (short (*) ()) 0; so #define NULL_FUNCTION ((short (*) ()) 0) Kevin kenny@Uiuc.ARPA kenny@Uiuc.CSNET {ihnp4, pur-ee, convex}!uiucdcs!kenny No opinions are expressed here, so no disclaimer is needed.