Re: Renaming versus initialisation



Tapio Kelloniemi <invalid@xxxxxxxxxxxxxxxxxxxxxxxxx> writes:

> V1 : T := F;
> V2 : T renames F;
>
> I'd like to see an explanation of the effect of an object renaming
> declaration versus variable declaration and initialisation, when the object
> being renamed is a return value of a function. Many thanks for it.

They are pretty similar. Differences: V2 is a constant, but V1 is a
variable. In Ada 95, V2 works for limited types, but V1 does not.
The rules about limited types are relaxed in Ada 2005.

- Bob
.



Relevant Pages

  • Re: Bus error
    ... Integer renames 1; -- Illegal ... Wheras I could say that a returned object is declared as part ... of the function declaration. ... because this invites all kinds of assumptions about numeric types. ...
    (comp.lang.ada)
  • Re: Using a generic instance to implement a public subprogram?
    ... Gautier wrote: ... renames Sqrt_internal; ... check.adb: Error: line 21 col 13 LRM:8.3, Illegal to override declaration in same region, Introducing new declaration anyway ... ObjectAda's use of the word "override" seems confusing; I don't think this has anything to do with overriding primitive operations. ...
    (comp.lang.ada)