Article View: comp.lang.misc
Article #2338Re: Pointers
From: J. Giles
Date: Fri, 06 Nov 1992 19:06
Date: Fri, 06 Nov 1992 19:06
30 lines
2239 bytes
2239 bytes
In article <1de603INN5qv@early-bird.think.com>, barmar@think.com (Barry Margolin) writes: |> [...] |> And it's possible to have aliasing without pointer variables. Fortran has |> this problem because parameters are passed by reference -- their solution |> was simply to legislate that programs are not permitted to pass array |> parameters (or is it all parameters) in such a fashion that such aliases |> would occur. It's not possible to detect this statically in the general |> case. Quite true. Fortran commits the same error as C, but in the reverse direction. What I want is for the language to allow aliasing, allow the user to explicitly state whether things are *really* aliased or not (with *NOT ALIASED* and the default). The fact that the non-alias legislation is not statically determinable is not relevant to me: I'm perfectly willing to take that responsibility for my use of the code. The point is that aliasing is an *inherent* part of what pointers do, it is merely a rarely used possibility with arrays (one which I'm perfectly willing to do completely without). The distinction is therefore naturally divided - if you *call* something an array, the compiler assumes it's not aliased to anything; if you *call* something a pointer the compiler assumes that it might be aliased. In short, part of the distinction you make between pointers and arrays is the explicit control over aliasing I mentioned in the preceding paragraph. Thus, if you coerce one to the other in every procedure call, you have lost a useful distinction. It's a bad idea to coerce arrays to pointers. -- J. Giles
Technical Details
Message-ID:
<1992Nov6.190610.5786@newshost.lanl.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!pmafire!mica.inel.gov!ux1!news.byu.edu!hamblin.math.byu.edu!sol.ctr.columbia.edu!caen!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlgReferences:
<1992Nov5.014143.15635@newshost.lanl.gov> <1992Nov5.051745.7369@linus.mitre.org> <1992Nov5.184831.16328@newshost.lanl.gov> <1de603INN5qv@early-bird.think.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.misc Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!mica.inel.gov!ux1!news.byu.edu!hamblin.math.byu.edu!sol.ctr.columbia.edu!caen!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlg From: jlg@cochiti.lanl.gov (J. Giles) Subject: Re: Pointers Message-ID: <1992Nov6.190610.5786@newshost.lanl.gov> Sender: news@newshost.lanl.gov Organization: Los Alamos National Laboratory References: <1992Nov5.014143.15635@newshost.lanl.gov> <1992Nov5.051745.7369@linus.mitre.org> <1992Nov5.184831.16328@newshost.lanl.gov> <1de603INN5qv@early-bird.think.com> Date: Fri, 6 Nov 1992 19:06:10 GMT Lines: 30