Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: Prohibiting...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 20 Topic 5612 of 5931
Post > Topic >>

Re: Prohibiting dynamic allocation for the given type

by gpriv@[EMAIL PROTECTED] Mar 19, 2008 at 08:43 AM

On Mar 19, 10:38 am, Adam Beneschan <a...@[EMAIL PROTECTED]
> wrote:
> On Mar 18, 8:06 pm, gp...@[EMAIL PROTECTED]
 wrote:
>
>
>
> > On Mar 18, 5:30 pm, Maciej Sobczak <see.my.homep...@[EMAIL PROTECTED]
> 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

Agree.

The only thing that I can see it useful is some sort of Lock object
attached to the mutex (or like).  Allocating this object dynamically,
will mean that a user has no concept of what this object suppose to do
therefore not knowing what he/she is doing.

George.
 




 20 Posts in Topic:
Prohibiting dynamic allocation for the given type
Maciej Sobczak <see.my  2008-03-18 14:30:37 
Re: Prohibiting dynamic allocation for the given type
gpriv@[EMAIL PROTECTED]   2008-03-18 20:06:45 
Re: Prohibiting dynamic allocation for the given type
Maciej Sobczak <see.my  2008-03-19 01:24:57 
Re: Prohibiting dynamic allocation for the given type
Georg Bauhaus <rm.tsoh  2008-03-19 12:31:23 
Re: Prohibiting dynamic allocation for the given type
Georg Bauhaus <rm.tsoh  2008-03-19 23:17:46 
Re: Prohibiting dynamic allocation for the given type
gpriv@[EMAIL PROTECTED]   2008-03-19 06:13:16 
Re: Prohibiting dynamic allocation for the given type
Maciej Sobczak <see.my  2008-03-19 06:54:45 
Re: Prohibiting dynamic allocation for the given type
Pascal Obry <pascal@[E  2008-03-19 15:12:05 
Re: Prohibiting dynamic allocation for the given type
"Randy Brukardt"  2008-03-19 18:08:34 
Re: Prohibiting dynamic allocation for the given type
Simon Wright <simon.j.  2008-03-20 20:26:19 
Re: Prohibiting dynamic allocation for the given type
Adam Beneschan <adam@[  2008-03-19 07:38:37 
Re: Prohibiting dynamic allocation for the given type
gpriv@[EMAIL PROTECTED]   2008-03-19 08:43:17 
Re: Prohibiting dynamic allocation for the given type
Eric Hughes <eric.eh9@  2008-03-19 09:37:46 
Re: Prohibiting dynamic allocation for the given type
Robert A Duff <bobduff  2008-03-19 20:48:18 
Re: Prohibiting dynamic allocation for the given type
gpriv@[EMAIL PROTECTED]   2008-03-19 16:40:46 
Re: Prohibiting dynamic allocation for the given type
Robert A Duff <bobduff  2008-03-19 20:43:56 
Re: Prohibiting dynamic allocation for the given type
Maciej Sobczak <see.my  2008-03-20 14:11:29 
Re: Prohibiting dynamic allocation for the given type
Eric Hughes <eric.eh9@  2008-03-20 14:35:42 
Re: Prohibiting dynamic allocation for the given type
Eric Hughes <eric.eh9@  2008-03-20 15:03:46 
Re: Prohibiting dynamic allocation for the given type
"Randy Brukardt"  2008-03-20 20:04:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 19:46:50 CDT 2008.