From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9fd97969641aa8c6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: how can i allocate an objekt with initialization??? Date: Mon, 13 Dec 2004 12:11:33 +0100 Organization: None Message-ID: <1857868.XuSmkFVpml@linux1.krischik.com> References: <3459883.9H2ke8dEzz@linux1.krischik.com> <41b44663$0$9298$ba620e4c@news.skynet.be> <1654535.Ng2VDZFboh@linux1.krischik.com> Reply-To: martin@krischik.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1102937136 04 32145 gbb9XaLJZvD8iuV 041213 11:25:36 X-Complaints-To: usenet-abuse@t-online.de X-ID: Xj6OiiZA8eJ2wFD62++6HKM14Qlj92Wfgp3fdHjmdwIdD2dHjH7bsW User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:6915 Date: 2004-12-13T12:11:33+01:00 List-Id: Dave Thompson wrote: > On Mon, 06 Dec 2004 14:34:13 +0100, Martin Krischik > wrote: > >> > Ole-Hjalmar Kristensen wrote: >> > the corresponding C++ example should have been: > >> > a &my_object = b(1); >> >> I have seen this before and I am wondering if it is actualy valid. >> Because: where is the result of the b(1) constructor call been stored? a& >> can only hold a reference to retun value. > > In a temporary which persists as long as the reference, 12.2p5. You live and learn! > (Aside: auto is the default storage class where it applies, to local > variables, so does not need to be and usually is not given explicitly. > Especially since in C++ and C99 'implicit int' is gone and the type > specifier must be present in the beginning part of a declaration. In > fact there have been semiserious proposals to 'recycle' the keyword > 'auto' to a new meaning since its existing one is so unnecessary.) Having learned pascal and modula 2 before C and C++ I don't consider it unnecessary. I consider it good for readability. If I see "auto" I know a variable is declared. If I just see "some_very_long_something somthing_else_after_a_tiny_space;" It's not quite as easy to see. Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com