Path: utzoo!utgpu!water!watmath!watdragon!violet!gjditchfield From: gjditchfield@violet.waterloo.edu (Glen Ditchfield) Newsgroups: comp.lang.c++ Subject: Re: possible bugs Summary: New version of pointer-to-function parameter bug. Keywords: pointer-to-function parameters Message-ID: <6170@watdragon.waterloo.edu> Date: 1 Apr 88 19:16:39 GMT References: <6112@watdragon.waterloo.edu> <552@cord.UUCP> Sender: daemon@watdragon.waterloo.edu Reply-To: gjditchfield@violet.waterloo.edu (Glen Ditchfield) Distribution: na Organization: U. of Waterloo, Ontario Lines: 36 In article <552@cord.UUCP> gwr@cord.UUCP (59451-GW Ryan) writes: >In article <6112@watdragon.waterloo.edu> gjditchfield@violet.UUCP writes: >> typedef int (*PFCCI)(char, char); // ptr to fn mapping 2 chars to int. >> void g( int (*p)(char, char) ); >i don't understand what you are trying to do here. g() is supposed to be >a function taking what parameters? I want g() to have one parameter, and I want that parameter to be a pointer to a function that takes two characters and returns an integer. The body of g() will call that parameter with characters of its own choosing. Imagine passing an ordering routine down to a sort function. Here's a more interesting version of the problem, again using Cfront 1.2.1. ---------------------------------------- int f( char* s, int (*p)(char, char) ) { return 0; }; int g( int (*p)(char, char) ) { return 0; }; ---------------------------------------- ccc pmf2.cc: "pmf2.cc", line 3: warning: s not used "pmf2.cc", line 3: warning: p not used "pmf2.cc", line 5: error: syntax error "pmf2.cc", line 5: error: syntax error "pmf2.cc", line 5: error: syntax error "pmf2.cc", line 5: error: syntax error "pmf2.cc", line 6: error: syntax error "pmf2.cc", line 6: error: syntax error "pmf2.cc", line 7: error: syntax error 7 errors ---------------------------------------- One declaration of p is accepted, but the other is illegal. Is g() accepted by later versions of cfront?