[M3devel] Rd.GetText Question
Tony Hosking
hosking at cs.purdue.edu
Sat Jul 9 18:57:49 CEST 2011
Hmm. GetText(rd, Rd.Length(rd)) will fail with a run-time error if Length returns -1 because -1 is not a CARDINAL. I don't think this is generally a safe idiom.
On Jul 8, 2011, at 10:44 PM, Ken Durocher wrote:
> The Rd interface defines GetText as GetText(rd: T; len: CARDINAL): TEXT;
>
> I've noticed in different values for len in different places. Some use Rd.Length(rd) while others use LAST(CARDINAL).
>
> The latter would limit the text to about 2GB on a 32bit system, correct? But does Rd.Length() always know what the length will be?
>
> The interface for Rd states this for Rd.Length():
> "If len(rd) is unknown to the implementation of an intermittent reader, Length(rd) returns -1."
>
> So my question is, which should I use? Another option would be reading in some arbitrary amount and then looping until EOF. Which method is best?
>
> Thanks.
More information about the M3devel
mailing list