delorie.com/archives/browse.cgi | search |
Message-ID: | <378AB489.75F19B1E@unb.ca> |
From: | Endlisnis <s257m AT unb DOT ca> |
Organization: | Nortel Networks |
X-Mailer: | Mozilla 4.51 [en] (Win98; U) |
X-Accept-Language: | en |
MIME-Version: | 1.0 |
Newsgroups: | comp.os.msdos.djgpp,comp.lang.c++ |
Subject: | Re: Casting a class as a function pointer. |
References: | <378A2FFE DOT D9A4F8A0 AT americasm01 DOT nt DOT com> <slrn7ol5nn DOT 7fp DOT sbnaran AT localhost DOT localdomain> |
Lines: | 28 |
Date: | Tue, 13 Jul 1999 03:36:36 GMT |
NNTP-Posting-Host: | 209.226.124.243 |
X-Trace: | news21.bellglobal.com 931836996 209.226.124.243 (Mon, 12 Jul 1999 23:36:36 EDT) |
NNTP-Posting-Date: | Mon, 12 Jul 1999 23:36:36 EDT |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Siemel Naran wrote: > On Mon, 12 Jul 1999 14:12:14 -0400, Campbell, Rolf > >I've tried this: > >struct a { > > int a; int b; > > operator (int(*)(int)) (); > > }; > >But, it didn't work in gcc v2.8.1 for HP-UX. Making a typedef works fine, > >but I need to know if it is possible without a typedef. > > 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 "*". > However, operator conversions are rarely a good idea. 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. -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT HotMail DOT com ICQ: 32959047
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |