[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Aliasing and Garbage Collection



There used to be no way to take the address of a variable in Fortran,
but I thought this had changed with F9X or F00.  Is it still not
possible?  (I haven't programmed in Fortran for years).

You can still get aliasing with Fortran if you try very hard by using
the equivalent (equivalence?) command that allows the same area of
memory to be referenced by different variables.

Also, since arrays are passed by reference, so it is (was, with F77)
still possible to have the problem with matrix multiplication (for
example) that was described in an earlier post (IIRC).

If you're looking for a language in which aliasing is not possible, you
could try Oz/Mozart.  The = operator only assigns once; subsequent use
on an assigned variable throws an exception.  It can also use value
assignment as a form of synchronization (so "if X > Y" will block until
X and Y have values assigned by another thread).  (I haven't used Oz
(yet) so apologies if I'm not quite accurate about any of this).

Andrew

[I'm confused what any of this has to do with Java threads - I don't
mind reading this stuff, but I apologise if it seems too off-topic for
others]

Oyvind Teig wrote:
> 
> Hi
> 
>   Fortran does not allow aliasing, but how is it enforced?
> 
>   The word "alias" does not appear in the official X3J3/90.4
>   Fortran specification:
>     http://www.fortran.com/fortran/stds_docs.html
>     http://www.fortran.com/fortran/F77_std/rjcnf.html
> 
>   I also have studied other documents, but have not come
>   across the answer.
> 
>   Did occam compiler writers reuse the Fortran algorithms in
>   any way?
> 
> --
> Oyvind
> 
> @ Oyvind Teig (oyvind.teig@xxxxxxxxxxxx, oyvind.teig@xxxxxxxxxxxx)
> @   Navia Maritime AS, division Autronica, 7005 Trondheim Norway
> @   Tel: +47 73 58 12 68, Fax: +47 73 58 10 01
> @   http://www.autronica.no/
> @   Now part of world's largest company in maritime electronics:
> @   http://www.kongsberg.com/
> @ Publications at: http://www.autronica.no/pub/tech/rd/index.htm