Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!munnari!mulga!ditmela!latcs1!mcbain From: mcbain@latcs1.oz (Mike McBain) Newsgroups: comp.sources.bugs,comp.sources.d Subject: C program database source - bugfix Message-ID: <3615@latcs1.oz> Date: Sun, 4-Oct-87 22:52:34 EDT Article-I.D.: latcs1.3615 Posted: Sun Oct 4 22:52:34 1987 Date-Received: Fri, 9-Oct-87 01:05:15 EDT Organization: Comp Sci, La Trobe Uni, Australia Lines: 34 Keywords: pointers to functions Xref: mnetor comp.sources.bugs:349 comp.sources.d:1335 The recent posting of the C source database system looks like a really useful piece of software. While there seem to be some traps for the unwary SysV user associated with dir.h vs ndir.h, there is a portability and/or reality problem with at least one line in lid.c. In that file occurs the following line: if ((doit == lookId && !forceMerge)..... The problem with this expression is that doit is a pointer and lookId is a pointer to function. Why is this a problem? Because K&R do not actually state whether or not a function has an address that can be pointed to. So my compiler (on a National Semiconductor 3216) comes up with the 'incompatible arguments'. This problem can be solved with the following cast expression; if ((doit == (void(*)())lookId && !forceMerge) which should work for everyone. This may be an obscurity, but is also part of both the pleasure and the pain of a language like C Mike McBain, ISD: +61 3 479-2393 Department of Computer Science, STD: (03) 479-2393 La Trobe University, ACSnet: mcbain@latcs1.oz Bundoora, CSnet: mcbain@latcs1.oz Victoria, 3083, ARPA: mcbain%latcs1.oz@uunet.uu.net Australia UUCP: ...!uunet!munnari!latcs1.oz!mcbain hplabs mcvax ukc nttlab