From 9014134271698432628
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,9d57bb38940f08c2
X-Google-Attributes: gidf78e5,public
From: Francis Glassborow <francis@robinton.demon.co.uk>
Subject: Re: References to functions allowed?
Date: 1999/01/18
Message-ID: <OxDGwfArQyo2EwCV@robinton.demon.co.uk>#1/1
X-Deja-AN: 434032766
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <36A222B3.E51DFD28@ibm.net>
X-UID: 0000000001
X-Status: $$$T
Organization: Southfield Microcomputer SS
Mime-Version: 1.0
Reply-To: Francis Glassborow <francisG@robinton.demon.co.uk>
Newsgroups: comp.std.c++
Originator: clamage@taumet


In article <36A222B3.E51DFD28@ibm.net>, Biju Thomas <bijuthom@ibm.net>
writes
>Hello,
>
>Does the C++ standard allow references to functions? For example, is the
>following legal?
>
>int f () {}
>
>int (&rf)() = f;

But you have a type mismatch.  On the lhs you have declared rf to be a
reference to a function.. and on the rhs f is a pointer to a function...

Would you expect:

int i;
int & ri = &i;

to compile?

In simple terms IMO I do not think there is any syntactic way that you
can write a reference to a function (*f does not work because under the
rules that is converted to a pointer)


Francis Glassborow      Chair of Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




