From: "Campbell, Rolf [SKY:1U32:EXCH]" Newsgroups: comp.os.msdos.djgpp,comp.lang.c++ Subject: Re: Casting a class as a function pointer. Date: Tue, 13 Jul 1999 13:29:40 -0400 Organization: Nortel Networks Lines: 37 Message-ID: <378B7784.E718C436@americasm01.nt.com> References: <378A2FFE DOT D9A4F8A0 AT americasm01 DOT nt DOT com> <378AB489 DOT 75F19B1E AT unb DOT ca> NNTP-Posting-Host: bmerhc00.ca.nortel.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.6 [en] (X11; I; HP-UX B.10.20 9000/712) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Siemel Naran wrote: > >> I think that it is possible. Probably something along the lines of this: > >> int (operator () *const)(int) { return &f; } > >That gets a parse error before "*". > Yes, I know. But I mean that the solution is something along the lines > of this, where the "operator" keyword appears after the return type of > the returned function. Kind of like for the member function returning > a pointer to a non-member or class static function. I tried various > combinations, all without any luck. Ask on comp.std.c++ as you might > get an answer. I'm beginning to think that it isn't possible. As someone already told me. > Incidentally, how to make an array of function pointers using 'new' > and without using 'typedef', and without using containers. With > typedef, we say I think this suffers from the same problem, and is impossible. > > Thanx for the advice, but I'm not actually trying to use this construct, > >I'm making a code parser and just wanted to know what to expect. > Fine. If you don't know what to do just yet, just have your code > parser reject this outright. I don't think anyone writes codes like > this anyway. Actually, what I'm going to do is accept any standard cast as an operator: operator int (*)() (); This isn't syntactically correct, but it should never arrise and it means I don't have to make another type parser. -- -Rolf Campbell (39)3-6318