Article View: comp.lang.misc
Article #1890Re: C's sins of commission
From: Greg Lindahl
Date: Fri, 02 Nov 1990 05:28
Date: Fri, 02 Nov 1990 05:28
19 lines
1386 bytes
1386 bytes
In article <3673@stl.stc.co.uk> "Tom Thomson" <tom@nw.stl.stc.co.uk> writes: >Jim's arrays and indices down them are all very well, but they certainly >do not solve the aliasing issue he claims they solve; if I write > a[i] := a[j] the compiler does not in general know whether i and j >have different values, ie whether i and j are distinct. Er, actually the example I use from my code looks like this: a[i] = b[i] / c[i]; d[i] = b[i] * c[i]; Fortran only loads b[i] and c[i] once. C, if you confuse the issue by using pointers, will generally load b[i] and c[i] twice. If the locations of b or c are passed in, no C compiler that I know of will optimize it. You can talk about the general case, and you can debate the definition of a pointer, but don't make my code run 30% slower.
Technical Details
Message-ID:
<1990Nov2.052815.22188@murdoch.acc.Virginia.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!decwrl!mcnc!uvaarpa!murdoch!astsun9.astro.Virginia.EDU!gl8fReferences:
<1990Oct26.155937.29185@maths.nott.ac.uk> <PCG.90Oct30201101@teachk.cs.aber.ac.uk> <3673@stl.stc.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!decwrl!mcnc!uvaarpa!murdoch!astsun9.astro.Virginia.EDU!gl8f From: gl8f@astsun9.astro.Virginia.EDU (Greg Lindahl) Newsgroups: comp.lang.misc Subject: Re: C's sins of commission Message-ID: <1990Nov2.052815.22188@murdoch.acc.Virginia.EDU> Date: 2 Nov 90 05:28:15 GMT References: <1990Oct26.155937.29185@maths.nott.ac.uk> <PCG.90Oct30201101@teachk.cs.aber.ac.uk> <3673@stl.stc.co.uk> Sender: news@murdoch.acc.Virginia.EDU Organization: Department of Astronomy, University of Virginia Lines: 19