Re: Optional arguments (again) on Sun



Salvatore <sfilippone@xxxxxxxxxxx> wrote:

On Feb 19, 4:03 pm, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
Salvatore <sfilipp...@xxxxxxxxxxx> wrote:
Ah. yes, I was missing the small print on the SIZE description,

[that dim must not be an optional dummy argument]

The reason for that small print is that having dim changes the rank of
the result.

However, according to my copy of M&R,

"size(array,[dim=]) returns a scalar default integer that is the size
of the array array or extent along dimension dim .... "

so it would seem that your explanation, while certainly appropriate
for LBOUND/UBOUND, is at least surprising here where there seems to
be no such change of rank.

Good point. I just reacted to the bit about dim not being optional
bcause that's usually the reason for that kind of restriction. Hmm. Now
that you mention it, why is there such a restriction for size()?... And
checking further, where is it that this alleged restriction is found? I
can't find any such thing or figure out why there would be one. Did I
just miss it, or is it not actualy there. Anyone have a citation from
the standard on this (not from M&R or any other source - though I don't
off-hand see this one in skimming the latest MR&C either)?

On the point in your other posting:

The funny thing is that in my original code (not the one I first
posted here) the size(arg,dim=dim) was inside an IF (PRESENT(DIM)),
presumably it was hard for the compiler to figure out it was safe in
that case.

If there is a restriction (which I'm not convinced that there is), then
it wouldn't be that detailed. There are lots of restrictions for things
that don't have the envisioned problem in special cases. Nonetheless,
the restrictions still apply. In a case like UBOUND, which does have the
mentioned restriction, the restriction does not read "unless the
compiler can figure out that it is ok". So it really doesn't matter
whether or not the compiler can figure out that it is ok. What would be
too complicated here would be precisely elaborating a virtually infinite
number of special cases for all kinds of things like that throughout the
standard.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: Optional arguments (again) on Sun
    ... [that dim must not be an optional dummy argument] ... The reason for that small print is that having dim changes the rank of ... F90/95/2003 is designed so that the rank of everything is ... The presence of an optional dummy argument is not ...
    (comp.lang.fortran)
  • Re: **Pop-up message prompting for user information**
    ... Only reason I want this is because our userID's are weird numbers and people ... "Susan" wrote: ... Dim sUser As String ...
    (microsoft.public.excel.programming)
  • Doubleclick on a treeview node - sometimes it works and sometimes not
    ... The productive database had lost one required reference - for what reason ... Dim lst As String ... lngVorgaenger As Long) ... Set rst = db.OpenRecordset("SELECT lngQuotationNr, ...
    (microsoft.public.access.formscoding)
  • Re: Ranking, subqueries and update query problem
    ... >> Private Sub RankRecord() ... >> Dim rst As Object ... >> ‘Original rank ...
    (microsoft.public.access.queries)
  • Re: Rank function
    ... Dim myUScores() As Double ... Dim iPos As Integer ... iFirst = Application.Match(rSection.Value, rSections, False) ... Section ID No Marks Rank-formula Actual Rank ...
    (microsoft.public.excel.worksheet.functions)