gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] Re: GM2 ISO


From: Iztok
Subject: Re: [Gm2] Re: GM2 ISO
Date: Fri, 09 May 2003 14:56:09 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020903

Gaius Mulley wrote:

Iztok <address@hidden> writes:

Gaius Mulley wrote:

As implemented, LENGTH takes only constant parameter while it should
take variable ones also. I've checked with my GP M2, SB M2 and XDS M2
manuals as well as with the few sites that have ISO M2 doc. It seems
that while some have had doubts about LENGTH being pervasive at
beginning, they all have adopted it and made it take variable
parameter as well.

thanks for reporting this. I had thought that LENGTH only should work
with constants, but it is easy to alter this. It raises a couple of
questions:

  (i)   does LENGTH(a) behave like HIGH(a)+1 for an open array
        or                         strlen(a)
LENGTH = Strings.Length = strlen

I think that this was the point of LENGTH discussions - LENGTH has its function only when pervasive. If imported, there was no difference between LENGTH and Strings.Length. And the reason for implementing LENGTH is only for not importing Strings module at all. Which, again, is more important for compilers which can not optimize for unaccessed code at link time. Which, I hope (and unfortunately do not know) gcc and gm2 do.

  (ii)  within constant expressions, presumably LENGTH is limited to
        a constant parameter.
I think that the compiler has enough information to use the constant string length constant at the compile time, and it should. Which again can not be the case with the Strings.Length where the constant string could only be evaluated at run time. And might be that it was another reason for LENGTH implementing.

I.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]