[Info-vax] VMS Basic strings class D vs class S
Scott Dorsey
kludge at panix.com
Wed Feb 28 09:56:52 EST 2024
In article <urnggb$3trjg$1 at dont-email.me>,
=?UTF-8?Q?Arne_Vajh=C3=B8j?= <arne at vajhoej.dk> wrote:
>On 2/26/2024 4:17 PM, Stephen Hoffman wrote:
>> On 2024-02-25 21:33:33 +0000, Arne Vajhøj said:
>>
>>> If I have understood it correctly then VMS Basic strings use class D
>>> descriptors.
>>>
>>> That is very nice.
>>>
>>> But what happens if non-Basic code call Basic code with a string using
>>> a class S descriptor? For input/read? For output/write?
>>>
>>> Does the Basic runtime call some STR$ function that understands the
>>> difference between S and D and handle A properly? Or will I get a
>>> runtime error due to invalid string?
>>
>> "It depends."
>>
>> Most everything in most of the traditional languages and in the RTLs
>> does the right thing with both dynamic and static text strings, though
>> the app code involved might not. BASIC app code works pretty well here,
>> absent "heroic" efforts by the app developer.
>>
>> If the app code assumes a dynamic arriving and gets handed static, the
>> RTL will either copy it, or space-pad the results into the static, or
>> the RTL will return a string truncation error. BASIC space-pads into
>> static string buffers if and as needed. Or truncates with an error.
>
> > Apps expecting to work with dynamic descriptors might fail with the
> > truncation error as mentioned, and apps expecting to massage static
> > descriptors directly and not coded sufficiently cautiously around any
> > arriving dynamic strings can fail with heap and other errors.
>
>Basic cannot stuff 200 bytes into a 100 bytes fixed length string. That
>is fair.
Fortran can! And you likely won't notice that you have damaged some other
memory until you get a SIGSEGV in some totally unrelated part of your code.
--scott
--
"C'est un Nagra. C'est suisse, et tres, tres precis."
More information about the Info-vax
mailing list