🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1496

G++ doesn't handle pointers to functions

#1496
From: Michael Tiemann
Date: Wed, 12 Oct 1988 00:25
32 lines
1772 bytes
   Date: 11 Oct 88 21:45:49 GMT
   From: armada!becher@decwrl.dec.com  (Jonathan D. Becher)
   Organization: I have no organization (look at my desk)
   Sender: bug-g++-request@prep.ai.mit.edu

   The following program compiles with gcc but not with g++.
   It seems as if g++ doesn't understand formal parameters that
   are pointers to functions.
   If anyone can think of a way around this bug (or explain to me 
   why it isn't one), please let me know.
   I can't live without pointers to functions :->

From your previous posting, it is clear that you already know that
using a typedef solves this problem.  By using a typedef, you save
compilation time (less declarator structure to grok).  If, however,
you are somehow alergic to using typedefs, one thing you can do is this:

  doThis(auto int (*f)())
  {
      f();
  }

This will (or should) then compile.  This is a bug in the C++
language.  I wish that the designers of C++ knew enough about LALR
parsing to have made their language LALR-parsable; unfortunately, they
did not.  I consider the AT&T solution (which also doesn't always work
for pointers to functions in parameter positions) of using heuristics
to help try to guide the parser unacceptable, and certainly something
which I would want to distribute, freely or otherwise.

Michael
Technical Details
Message-ID: <8810120025.AA21027@lurch.stanford.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!LURCH.STANFORD.EDU!tiemann
References: <68@armada.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!LURCH.STANFORD.EDU!tiemann
From: tiemann@LURCH.STANFORD.EDU (Michael Tiemann)
Newsgroups: gnu.g++.bug
Subject: G++ doesn't handle pointers to functions
Message-ID: <8810120025.AA21027@lurch.stanford.edu>
Date: 12 Oct 88 00:25:57 GMT
References: <68@armada.UUCP>
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 32