* Jonathan S. Shapiro:

> On Sun, Jun 17, 2012 at 10:45 AM, Florian Weimer <[email protected]> wrote:
>> Ada has the same problem (for arrays and class-wide types).  Some time
>> ago, GNAT on MIPS supported a special ABI where an allocating function
>> could return with an elevated stack pointer.

> The only cases I can think of where what you say would be necessary are:
>
>   1. Vectors (arrays of variable size) that are stack-allocated
>   2. Procedures that are generic over array size in covariant position
>      (e.g. at return types)
>
> These are effectively the same thing. Does Ada permit either of these?

Ada supports variable-sized arrays as values, without indirection, so
I would say it permits both.  Ada's arrays seem closer to vectors in
your terminology.

In addition, Ada 95 introduced class-wide types, which allow functions
to return objects of subclasses as values, without indirection.  This
means that the size of the returned object is not known to the caller.
On top of that, Ada 2005 permits returning non-copyable objects from
functions.  The caller determines the place where the object is
stored, but the callee specifies its size.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to