comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Prohibiting dynamic allocation for the given type
Date: Wed, 19 Mar 2008 07:38:37 -0700 (PDT)
Date: 2008-03-19T07:38:37-07:00	[thread overview]
Message-ID: <9ac94db1-01e1-4ce3-81d3-27f8b11f7662@h11g2000prf.googlegroups.com> (raw)
In-Reply-To: bbf57cd3-2b37-4a48-8fad-d8ce72968957@e39g2000hsf.googlegroups.com

On Mar 18, 8:06 pm, gp...@axonx.com wrote:
> On Mar 18, 5:30 pm, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
>
> > Is it possible to "prohibit" dynamic allocation for the given type?
>
> > Let's suppose that I have a type which instances make sense only on
> > the stack.
>
> Ada is high level language and stack is implementation specific
> entity. ARM does not mention how the local objects are allocated (it
> simply irrelevant).  In fact, GNAT uses two stacks for different type
> of objects but users don't have to know these details.
>
> > I want to prohibit users from dynamically allocating
> > instances of this type so that they don't get into troubles.
> > Preferably at compile-time.
>
> What's wrong with good old comments atop of type declaration. Like
> some beverages have: "for most enjoyment serve chilled" or "for best
> performance avoid heap allocation".
>
> Don't know if it's ever possible to do it during compile, nothings
> comes to my mind. But if you insist you may do run-time check by
> defining custom Storage_Pool pool for your object and raising
> exception from Allocate method. See ARM 3.11 for details.

No, you can only specify a Storage_Pool for an *access* type; you
can't specify that "all allocated instances of an object type will go
through such-and-such a Storage_Pool".

                                   -- Adam



  parent reply	other threads:[~2008-03-19 14:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-18 21:30 Prohibiting dynamic allocation for the given type Maciej Sobczak
2008-03-19  3:06 ` gpriv
2008-03-19  8:24   ` Maciej Sobczak
2008-03-19 11:31     ` Georg Bauhaus
2008-03-19 13:13     ` gpriv
2008-03-19 13:54       ` Maciej Sobczak
2008-03-19 16:37     ` Eric Hughes
2008-03-20  0:48       ` Robert A Duff
2008-03-20 21:35         ` Eric Hughes
2008-03-19 22:17     ` Georg Bauhaus
2008-03-19 23:40       ` gpriv
2008-03-20 21:11       ` Maciej Sobczak
2008-03-19 14:38   ` Adam Beneschan [this message]
2008-03-19 15:43     ` gpriv
2008-03-19 14:12 ` Pascal Obry
2008-03-19 23:08   ` Randy Brukardt
2008-03-20 20:26     ` Simon Wright
2008-03-20 22:03       ` Eric Hughes
2008-03-21  1:04         ` Randy Brukardt
2008-03-20  0:43 ` Robert A Duff
replies disabled

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