Re: Reversing Array Elements?
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Mon, 15 Jun 2009 10:24:50 -0700
glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx> wrote:
steve <kargls@xxxxxxxxxxx> wrote:
< So, for the pointer p, the compiler sets up a dope vector
< and 'points' the first element of p at the last element of
< a.
So it doesn't actually reverse the array.
Depends what you mean by "actually reverse the array". It is an array.
It has the elements in reverse order. It doesn't force making a copy of
the array stored in a reverse memory layout; I assume that's what you
mean by "actually reverse the array".
That is a fairly low-level implementation-oriented view (not surprising)
rather than a specification of the language. The language specification
is deliberately more abstract than that. As a result, it gets hard to
absolutely guarantee much of anything at that level. The best one can do
is describe typical or easy implementations. An implementation certainly
could make such a reordered copy in physical memory as an optimization.
In fact, if you pass such an array as an actual argument to an
explicit-shape or assumed-size dummy, it very likely would result in a
copy reordered in physical memory. So would assignment.
While I'm no expert (at al) on IDL, I'd guess that the same was true
there - that you don't have a guarantee that the operation in question
causes a physically reversed copy in memory.
And for that most part, I'd guess that one would not and should not
care. There are legitimate questions relating to performance. But that's
a separate question from the one of whether the language defines the
operation. See Michael's comment:
but I have no idea how (in)effecient that is.
--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
.
- References:
- Reversing Array Elements?
- From: Rob
- Re: Reversing Array Elements?
- From: dpb
- Re: Reversing Array Elements?
- From: m_b_metcalf
- Re: Reversing Array Elements?
- From: steve
- Re: Reversing Array Elements?
- From: glen herrmannsfeldt
- Reversing Array Elements?
- Prev by Date: Re: Reversing Array Elements?
- Next by Date: Re: Why a PRINT statement changes calculation result?
- Previous by thread: Re: Reversing Array Elements?
- Next by thread: Re: Reversing Array Elements?
- Index(es):
Relevant Pages
|