From: minow@thundr.dec.com (Martin Minow THUNDR::MINOW ML3-5/U26 223-9922)
Subject: re: Bug in Basic-Plus for RSTS V8.0? -- nope
Date: 16 Dec 87 17:57:00 GMT [thread overview]
Message-ID: <8712161511.AA12833@decwrl.dec.com> (raw)
Gerald Vogt thinks he has found a bug in RSTS/E Basic-Plus. To simplify
his sample program, he defines a record I/O field:
20 field 1%, 3% as a$, 20% as i$, 15% as q$
and assigns an element from the field to a variable:
70 in$(z%) = i$
The program fails when in$(z%) contains nothing when the file is closed.
The problem, which should be discussed in the Basic-Plus documentation,
is that a direct string assinment "foo$ = bar$" copies string pointers
from the source to the destination. The contents are not duplicated.
Thus, in Gerald's example, in$(z%) contains the address of i$ in the
file buffer and the contents of in$(z%) change as the file changes.
The program will work as Gerald wants if he changes his code to
70 in$(z%) = i$ + ""
By concatenating a null string to the record field, Basic-Plus will
allocate new memory and copy the contents of the string from the
buffer. Gerald's solution:
70 in$(z%) = left(i$, 20%)
does the same thing.
Hope this helps.
Martin Minow
minow%thundr.dec@decwrl.dec.com
The above does not represent the position of Digital Equipment Corporation.
reply other threads:[~1987-12-16 17:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox