[Info-vax] Whither VMS?
John Reagan
johnrreagan at earthlink.net
Tue Oct 6 13:40:15 EDT 2009
"JF Mezei" <jfmezei.spamnot at vaxination.ca> wrote in message
news:0083cc77$0$30078$c3e8da3 at news.astraweb.com...
> Re: C and buffer overflows.
>
> Is there a language which keeps 2 values for each string: amount
> allocated and amount currently in use ?
Pascal (well, Extended Pascal, but OpenVMS Pascal has that from the EP
standard).
The predeclared STRING type will take a run-time expression for the maximum
capacity. You can get the current length with LENGTH() and you can get the
max capacity with the ".CAPACITY" descriminant.
Underneath, we use a leading length word on the string so you are limited to
64K characters. For ease of implementation, we use a longword at run-time
to keep the CAPACITY, but check that it doesn't exceed 64K.
Note this is more flexible than the VARYING OF CHAR in OpenVMS Pascal
(stolen from PL/I) which only allows compile-time expressions as the maximum
length.
John
More information about the Info-vax
mailing list