Post by akarlPost by Chris BurrowsPost by akarlDoes anyone know why the built in function LEN does not accept pointers
to arrays when `.' and `[]' implies pointer dereference? (E.g. `LEN(s)'
is not valid if `s: POINTER TO ARRAY OF CHAR'.)
It works OK for me using the ETH PlugIn Oberon for Windows. Which flavour
of Oberon are you using?
Interesting. I use OOC and XDS. According to the Oberon report the
argument type of LEN must be an array.
Yes - you are right. However, it looks as if others have been concerned
about this issue as the Component Pascal language report (which was derived
from the Oberon report) adds the following:
'Dereferencing is also implied if a pointer is assigned to a variable of a
record or array type (Ch. 9.1), if a pointer is used as actual parameter for
a formal parameter of a record or array type (Ch. 10.1), or if a pointer is
used as argument of the standard procedure LEN (Ch. 10.3).'
http://www.oberon.ch/pdf/CP-Lang.pdf
I guess that to be safe you should explicitly dereference the array, i.e.
use the construct:
LEN(s^)
This should always work whichever version of Oberon or Component Pascal you
are using.
--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp