comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: How to pass around access types to interfaces?
Date: Wed, 29 Oct 2008 15:15:20 +0100
Date: 2008-10-29T15:15:20+01:00	[thread overview]
Message-ID: <49086ff8$1@news.post.ch> (raw)
In-Reply-To: <8bd7e8eb-b463-4dea-8b62-42b6486557f0@u65g2000hsc.googlegroups.com>

Maciej Sobczak schrieb:
> On 26 Paź, 16:50, "Martin Krischik" <krisc...@users.sourceforge.net>
> wrote:
> 
>> But then: access to class wide is the kind of  
>> access which a C++ convert will uses without realy needing them. I should  
>> know, I am a C++ convert who made precisely that mistake.
> 
> It might depend on what you did in C++ before converting. ;-)
> Since most of the code does not need pointers anyway, the frequent
> idiom is to pass objects by reference (likely to the base class),
> something like:
> 
> void foo(const SomeClass & object);

Not the function call is the problem - the creation and storage of
objects is.

For example: now are you going to fill a vector<base_class&> with
objects? And how do you delete those objects again? This is where C++ lags.

In Ada we have Ada.Container.Indefinite_Vector which can hold Base'Class
objects. (Remember that is was me who requested the inclusion of
Ada.Container.Indefinite_Vector into the standard. It was also me who
created BC.Indefinite_Containers)

> I think that in the above context what is *really* dangerous and
> difficult to clean up is the C background, not C++. Unfortunately the
> former one prevails.

Well I did C before C++ and Modula-2 before that and Pascal before that.

Martin

-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



  reply	other threads:[~2008-10-29 14:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-24 11:45 How to pass around access types to interfaces? Sven
2008-10-24 12:24 ` Niklas Holsti
2008-10-24 12:49   ` Sven
2008-10-24 13:55     ` Ludovic Brenta
2008-10-24 21:32 ` sjw
2008-10-25  8:54   ` Sven
2008-10-25 15:43 ` Martin Krischik
2008-10-25 22:15   ` Robert A Duff
2008-10-26  8:02     ` Dmitry A. Kazakov
2008-10-26 15:50     ` Martin Krischik
2008-10-28 13:41       ` Maciej Sobczak
2008-10-29 14:15         ` Martin Krischik [this message]
2008-10-31 13:38           ` Maciej Sobczak
2008-10-31 14:46             ` Dmitry A. Kazakov
2008-10-29 12:42   ` Sven
2008-10-29 13:17     ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox