Newsgroups: comp.theory,comp.lang.scheme,comp.software-eng
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!news.kei.com!newsfeed.internetmci.com!swrinde!cs.utexas.edu!news.sprintlink.net!mv!usenet
From: ENGR@GSSI.MV.COM (Michael Furman)
Subject: Re: Style: multiple returns and relatives
Message-ID: <DIEto8.FC3@mv.mv.com>
Mime-Version: 1.0
Organization: GSSI
Date: Tue, 21 Nov 1995 20:16:56 GMT
References: <RMARTIN.95Nov10210926@oma.com> <skfVWbO00VohAJimgc@andrew.cmu.edu> <1995Nov2022.03.11.15213@silverton.berkeley.edu> <DIEFEK.7py@mv.mv.com> <1995Nov2119.02.10.16041@silverton.berkeley.edu>
X-Newsreader: WinVN 0.93.10
X-Nntp-Posting-Host: gssi.mv.com
Lines: 54
Xref: glinda.oz.cs.cmu.edu comp.theory:14647 comp.lang.scheme:14363 comp.software-eng:39158

In article <1995Nov2119.02.10.16041@silverton.berkeley.edu>, 
djb@silverton.berkeley.edu says...
>  .................
>> How do you define (and detect) obviously-not-aliased arguments?
>
>The following two (local) rules suffice for most code, including all
>code translated from Fortran: 1. If you can see the declarations of
>two arrays x and y, you know that x+m and y+n are not aliased. 2. If
>you're inside the fast version of a function, and x and y are two
>arguments, you know that x+m and y+n are not aliased.
>

  Not exactly (about "all code translated from Fortran"). You forgot manual
memory allocation (very popular - at least for old dialects of fortran) -
declare one big array and pass part of it as parameters. I did not use
fortran for about 15 years but in C it may look:

   int memory[10000];

   main()
     {
     .............
     calculating index1 and index2 - it can be a very complicated algoritm
     some_function(memory + index1, memory + index2);
     }

In this case you do not know are arguments aliased or not because:
  1. you do not know values of index1 and index2;
  2. you do not know real sizes of arguments of some_functions.

But if you know that it is fortran (or translated from fortran) - you can
just assume that they are not aliased.

>
>> And as I remember (correct me if I am wrong) in Fortran all arguments can
>> be treated as no aliased.
>
>Right. My point is that the compiler can easily recognize this, even
>without any guarantees from the language.

I understand your point but it is true only for some class of programs - 
basically without dinamic memory allocation, pointer arithmetic e. t. c.

>
>---Dan

-- 
---------------------------------------------------------------
Michael Furman,                       (603)893-1109
Geophysical Survey Systems, Inc.  fax:(603)889-3984
13 Klein Drive - P.O. Box 97          engr@gssi.mv.com 
North Salem, NH 03073-0097            71543.1334@compuserve.com
---------------------------------------------------------------

