From -2565583505571969231
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,b66186007131abfb
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-07-07 23:25:02 PST
Path: bga.com!news.sprintlink.net!hookup!swrinde!howland.reston.ans.net!EU.net!sunic!sics.se!eua.ericsson.se!euax1i2c08!konfjo
From: konfjo@eua.ericsson.se (Fredrik Jonsson)
Newsgroups: comp.std.c++
Subject: Re: References
Date: 8 Jul 1994 06:14:12 GMT
Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
Lines: 26
Distribution: world
Message-ID: <2viqrl$ldm@euas20.eua.ericsson.se>
References: <773441081snz@mcmen.demon.co.uk>
Reply-To: konfjo@eua.ericsson.se
NNTP-Posting-Host: euax1i2c08.eua.ericsson.se
NNTP-Posting-User: konfjo

In article 773441081snz@mcmen.demon.co.uk, Adrian@mcmen.demon.co.uk (Adrian McMenamin) writes:
>Sorry if this is a FAQ but why is it not standard C++ to
>allow the initialisation of a referenceto type foo with
>a function that returns type foo?
>-- 
>Adrian
>Adrian@mcmen.demon.co.uk

Do you mean something like this?
 
   class Object { };

   Object setup() { 
      return *new Object;
   }

   int main() { 
      Object& obj = setup();
   }

I haven't verified if there are any violations against the standard in this
particular example but atleast there are no problems when compiling it.

_______________
Fredrik Jonsson



