[Info-vax] Whither VMS?

Michael Kraemer M.Kraemer at gsi.de
Sun Oct 4 22:10:56 EDT 2009


Jordi Guillaumes i Pons schrieb:
> En/na glen herrmannsfeldt ha escrit:
> 
>>  
>> < And one of the first languages that I used that had this "length byte"
>> < concept was UCSD-Pascal.  Which, from the very start, included a way
>> < to violate those bounds.  Go figure....
>>
>> PL/I also usually uses length at the beginning. 
> 
> 
> Yup! Only for VARYING CHAR variables. On the other hand, it uses 
> descriptors to pass string parameters so the called procedure knows the 
> length of the incoming string, being it fixed-length or varying.

So does C, thanks to null termination of read-only strings.
As for target strings, PL/I isn't any better, IMHO,
unless the standard has changed in the past 15 years.
They have a maximum length, if you exceed it on write, you'll
have a buffer overflow as well. Unless you have enabled
STRINGSIZE, of course, but this is rarely the case in
production code. And even if it is, what do you gain?
A production program which aborts due to STRINGSIZE raised.

A solution superior to C would be if PL/I allowed stuff like

DCL AA,BB,CC CHAR(*) VAR;
CC = AA || BB;

with automatic (re)allocation of CC with just the right length,
thanks to the descriptor concept.
Wasn't possible at the time I had to leave PL/I.

> 
> The more recent versions support C-isms like UNION, so the need to do 
> such idioms (when you have to debug a program where one structure is 
> based on the address of the last byte of another structure, which is 
> based on a record, which is based on a POINTER, using a DUMP, you start 
> to wonder what in #¢¢$@ was thinking the programmer about... ;)).

You don't need unions to mess up your programs.
The PL/I concept of BASED variables does that as well.
You can trash just everything, including your oh-so-secure descriptors.
I remember using this "trick" deliberately to modify the dimension
layout of array.
Add to that that PL/I passes arguments by reference (not by
value, as does C), and you have another possibility of
trashing data.




More information about the Info-vax mailing list