|
From: | john o goyo |
Subject: | Re: Access of elements of a string constant |
Date: | Sat, 4 Jan 2020 21:00:57 -0500 |
User-agent: | Mozilla/5.0 (X11; SunOS sun4u; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
Greetings, Michael. On 01/04/20 12:05, Michael Riedl wrote (in part):
[...] MODULE TstStrConst; IMPORT STextIO,SWholeIO; CONST NumStr = "0123456789ABCDF"; VAR i : CARDINAL; BEGIN STextIO.WriteLn; FOR i:=0 TO LENGTH(NumStr)-1 DO SWholeIO.WriteCard(i,2); STextIO.WriteString(" '"); STextIO.WriteChar(NumStr[i]); STextIO.WriteString("' "); SWholeIO.WriteCard(ORD(NumStr[i]),1); STextIO.WriteLn; END; STextIO.WriteLn; END TstStrConst.It can be fixed by a VAR string initialized in the module body - but that's less elegant.
I know not about PIM but that construct seems to be disallowed by ISO:NOTE 1 - An indexed value cannot be formed by indexing a string constant.
(ISO/IEC 10514-1, Sect. 6.8.4.2) john
[Prev in Thread] | Current Thread | [Next in Thread] |