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: Interfacing...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 26 of 27 Topic 5570 of 5966
Post > Topic >>

Re: Interfacing to C: big structures

by Robert A Duff <bobduff@[EMAIL PROTECTED] > Feb 28, 2008 at 10:53 AM

"Alex R. Mosteo" <amosteo@[EMAIL PROTECTED]
> writes:

> Actually I would have expected these types to be allocated in the stack.

Me, too.

> I likened them to indefinite types, but certainly the maximum size of
> some indefinite types may be known at compile time, so this set them
> apart and I was simplifying too much. Besides, at least one
> implementation, as Randy Brukardt said, uses the heap for them. Even if
> it's the compiler doing the management, this may be a no-go in some real
> time environments.
>
> Using the heap may be easier for an implementation; ...

Yes.

>...another question is
> if it is still doable in the stack.

Yes, it is doable.

>...I wonder what gnat does.

Puts it on the primary stack.

>...Is the
> secondary gnat stack considered a kind of heap?

No.  It's a stack.

>...Is this what gnat uses?

No.  The secondary stack is for objects of unknown size that
are returned as function results.  I think GNAT also uses
it in some other cases, such as records containing
controlled parts.

> Are there pragma Restrictions that could clarify this?

You can say:

    pragma Restrictions (No_Implicit_Heap_Allocations);

>...Just throwing
> questions in the air.
>
> I guess that if my proposal is deemed unacceptable, one can neither use
> anymore things like
>
> type T (Len : Natural) is record
>    Name   : String (1 .. Len);
>    Others : Whatever;
>    -- ...
> end record;

There are certainly cases where the above should not be used with
"Len => <dynamic expression>", because it prevents you from
calculating the maximum stack size for each task.  Or, you can
calculate it, but the answer is "the size of the address space",
which isn't very useful.

It might be OK if you change Natural to a range 1..100.

- Bob
 




 27 Posts in Topic:
Interfacing to C: big structures
Maciej Sobczak <see.my  2008-02-25 13:17:45 
Re: Interfacing to C: big structures
"Randy Brukardt"  2008-02-25 17:26:00 
Re: Interfacing to C: big structures
Robert A Duff <bobduff  2008-02-25 18:43:56 
Re: Interfacing to C: big structures
Stephen Leake <stephen  2008-02-26 08:53:14 
Re: Interfacing to C: big structures
"Randy Brukardt"  2008-02-26 15:12:17 
Re: Interfacing to C: big structures
"Randy Brukardt"  2008-02-25 17:26:00 
Re: Interfacing to C: big structures
"Randy Brukardt"  2008-02-25 17:26:00 
Re: Interfacing to C: big structures
"Steve" <nos  2008-02-25 18:36:35 
Re: Interfacing to C: big structures
"Alex R. Mosteo"  2008-02-26 13:00:28 
Re: Interfacing to C: big structures
Robert A Duff <bobduff  2008-02-26 09:05:48 
Re: Interfacing to C: big structures
"Alex R. Mosteo"  2008-02-26 16:19:45 
Re: Interfacing to C: big structures
Robert A Duff <bobduff  2008-02-26 10:33:15 
Re: Interfacing to C: big structures
"Alex R. Mosteo"  2008-02-26 17:21:42 
Re: Interfacing to C: big structures
Robert A Duff <bobduff  2008-02-26 20:28:48 
Re: Interfacing to C: big structures
David Thompson <dave.t  2008-03-10 01:38:30 
Re: Interfacing to C: big structures
Adam Beneschan <adam@[  2008-02-26 09:35:53 
Re: Interfacing to C: big structures
Simon Wright <simon.j.  2008-02-26 19:47:32 
Re: Interfacing to C: big structures
"Randy Brukardt"  2008-02-26 15:14:36 
Re: Interfacing to C: big structures
Robert A Duff <bobduff  2008-02-26 20:40:09 
Re: Interfacing to C: big structures
Robert A Duff <bobduff  2008-02-26 20:37:17 
Re: Interfacing to C: big structures
Maciej Sobczak <see.my  2008-02-27 05:23:48 
Re: Interfacing to C: big structures
Maciej Sobczak <see.my  2008-02-27 05:49:43 
Re: Interfacing to C: big structures
Adam Beneschan <adam@[  2008-02-27 09:12:06 
Re: Interfacing to C: big structures
Simon Wright <simon.j.  2008-02-27 20:37:58 
Re: Interfacing to C: big structures
"Alex R. Mosteo"  2008-02-28 12:30:26 
Re: Interfacing to C: big structures
Robert A Duff <bobduff  2008-02-28 10:53:21 
Re: Interfacing to C: big structures
"Alex R. Mosteo"  2008-02-29 11:45:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Fri Nov 21 23:23:02 CST 2008.