Pierre Hugonnet wrote
> Vittorio Caffa wrote:
> >
> > Those are really bad news to me! I thought TRANSFER() corresponds to
> > unchecked type conversion (UNCHECKED_CONVERSION) in Ada. I thought
> > it is just a question of changing the type associated with a given
> > piece of memory. (Actually very similar to EQUIVALENCE).
> >
> > Questions:
> > (a) Does the standard says that the compiler has to _copy_?
> > (b) If not, do you know any (non efficient) implentation which does
> > so?
>
> The standard doesn't say anything (I think) about that. I don't
> know how work the implementations of TRANSFER, but I guess that
> most of them actually copy the data into a temporary array.
Well, if the standard does not say anything, I do not see way a
compiler should implement TRANSFER() copying memory. By the way I think
the word transfer is not appropriate, translate or convert whould have
been better.
> TRANSFER is definitely not a alternative to EQUIVALENCE (which
> is theoretically obsolescent, but which has not be replaced).
> In particular you can write b = TRANSFER(a,...)
> but not TRANSFER(a,...) = b !
Sure. But you can write a = TRANSFER(b, ...) if you want to interpret b
as it had the type of a. In this sense I _believe_ that TRANSFER has the
functionallity of EQUIVALENCE. The advantage is that when a type
convertion is performed the word TRANSFER alerts you about what is going
on.
Cheers, Vittorio
-------------------------------------------------
Dr. Vittorio G. Caffa Tel.: (089) 6088-2054
IABG, Abt. AF 11 Fax: (089) 6088-3990
Einsteinstr. 20 E-Mail: [log in to unmask]
D-85521 Ottobrunn
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|