From: Martin Krischik <martin@krischik.com>
Subject: Re: how can i allocate an objekt with initialization???
Date: Mon, 13 Dec 2004 12:11:33 +0100
Date: 2004-12-13T12:11:33+01:00 [thread overview]
Message-ID: <1857868.XuSmkFVpml@linux1.krischik.com> (raw)
In-Reply-To: e4bqr0hceta53glsf02uvaifm7lfec5dte@4ax.com
Dave Thompson wrote:
> On Mon, 06 Dec 2004 14:34:13 +0100, Martin Krischik
> <martin@krischik.com> 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
next prev parent reply other threads:[~2004-12-13 11:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-05 16:54 how can i allocate an objekt with initialization??? Thomas Bruns
2004-12-05 22:51 ` Stephen Leake
2004-12-06 8:52 ` Martin Krischik
2004-12-06 10:04 ` Ole-Hjalmar Kristensen
2004-12-06 11:49 ` Adrien Plisson
2004-12-06 13:34 ` Martin Krischik
2004-12-13 6:38 ` Dave Thompson
2004-12-13 11:11 ` Martin Krischik [this message]
2004-12-06 11:55 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox