comp.lang.ada
 help / color / mirror / Atom feed
From: Oliver Kowalke <oliver.kowalke@gmx.de>
Subject: smart pointer dangerous (no -> operator)
Date: Fri, 16 Jan 2009 11:04:57 +0100
Date: 2009-01-16T11:04:57+01:00	[thread overview]
Message-ID: <gkpluq$vda$1@online.de> (raw)

Hello,
Ada doesn't support the dereference operator -> as C++.

So Ada provides only two ways to access the managed object?

- returning it via value : function Get(Pointer : Smart_Pointer) return
Object;

- returning it via access type : function Get(Pointer : Smart_Pointer)
return Access_Object;

- returning a proxy which implements the functions applicable to the managed
object

In the first case I can not manipulate the state of the managed object
(setting some internal data).
The second case is dangerous because the ownership 'constraint' can be
violated -> other code can call Unchecked_Delete on the returned access
type or assign it to another one.

How can case three be implemented in Ada if the smart ponter package is
generic?


regards,
Oliver



             reply	other threads:[~2009-01-16 10:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-16 10:04 Oliver Kowalke [this message]
2009-01-16 11:09 ` smart pointer dangerous (no -> operator) Dmitry A. Kazakov
2009-01-16 11:42   ` Georg Bauhaus
2009-01-16 12:43     ` Dmitry A. Kazakov
2009-01-16 21:21     ` Maciej Sobczak
2009-01-17 19:07       ` Georg Bauhaus
2009-01-16 11:46   ` Oliver Kowalke
2009-01-16 12:45     ` Dmitry A. Kazakov
2009-01-17  0:43   ` Brian Drummond
2009-01-17  9:28     ` Dmitry A. Kazakov
2009-01-16 20:08 ` Tero Koskinen
2009-01-16 21:16   ` Maciej Sobczak
2009-01-18 12:21 ` Samuel Tardieu
replies disabled

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