Article View: gnu.g++.bug
Article #1495G++ doesn't handle pointers to functions
From: Jonathan D. Becher
Date: Tue, 11 Oct 1988 21:45
Date: Tue, 11 Oct 1988 21:45
37 lines
1218 bytes
1218 bytes
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 :->
Program:
#include <stdio.h>
doSomething()
{
printf("I did\n");
}
doThis(int (*f)())
{
f();
}
main()
{
doThis(doSomething);
}
Compilation:
g++ version 1.25.0
/usr/local/lib/gcc-cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dvax -Dunix t.cc /tmp/cc011037.cpp
/usr/local/lib/gcc-c++ /tmp/cc011037.cpp -quiet -dumpbase t.cc -noreg -version -o /tmp/cc011037.s
GNU C++ version 1.25.0 (vax) compiled by GNU C version 1.25.
t.cc:9: undeclared variable `f' (first use here)
=====
Jon Becher
becher@cs.duke.edu -OR- argosy!becher@decwrl.dec.com
Technical Details
Message-ID:
<68@armada.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!labrea!decwrl!armada!becherShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!labrea!decwrl!armada!becher From: becher@armada.UUCP (Jonathan D. Becher) Newsgroups: gnu.g++.bug Subject: G++ doesn't handle pointers to functions Message-ID: <68@armada.UUCP> Date: 11 Oct 88 21:45:49 GMT Organization: I have no organization (look at my desk) Lines: 37