Xref: utzoo comp.lang.c++:13555 comp.std.c:4855 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!ugle.unit.no!nuug!ulrik!ifi!enag From: enag@ifi.uio.no (Erik Naggum) Newsgroups: comp.lang.c++,comp.std.c Subject: Re: Pointers to functions Message-ID: Date: 20 May 91 16:38:20 GMT References: <1512@caslon.cs.arizona.edu> <4253@inews.intel.com> Sender: enag@ifi.uio.no (Erik Naggum) Organization: Naggum Software, Oslo, Norway Lines: 39 In-Reply-To: enag@ifi.uio.no's message of Sun, 19 May 1991 22: 56:40 GMT Comments: Corrected version D P Gilbert writes: | | As I reach for the shift button to put yet another set of left and | right parentheses after a niladic function call I have begun to | wonder how to relieve such tedium. Wouldn't it be nice just to | write the function name without those parentheses (e.g. token.get | instead of token.get() ). The syntax of C tells me why but could | it be bent with a #pragma perhaps? Whenever I want the address of | a function I use "&" so I can understand my code 18 months later. Assuming struct ... { ... void (*get)(); ... } token; token.get() is a function call by virtue of the "()", while token.get is the value of the function pointer. Remember that statements such as 3; are legal in C, but sort of pointless. token.get; is no exception. Other languages don't know about function pointers and can alleviate the user of the power thereof. -- Erik Naggum Professional Programmer +47-2-836-863 Naggum Software Electronic Text 0118 OSLO, NORWAY Computer Communications