[FreeVMS] Re: Null Termination & Optional Arguments


Subject: [FreeVMS] Re: Null Termination & Optional Arguments
From: Glenn and Mary Everhart (Everhart@gce.com)
Date: Sun Dec 28 2003 - 04:23:34 CET


VMS may have arguments that are optional almost anywhere. Consider
the $qio call as a simple example: you can, for example, omit the AST
entry address and parameter arguments at will, though they are in
the middle of the argument list.

VMS code has been saved from probably at least hundreds of bugs, though, by
its insistence on using string descriptors rather than using a hack like null
termination. They are more trouble to set up, but they enforce that
everyone knows not only where the buffer is, but how large it is, and
ensure that information gets carried around and followed.

Take a quick look at some of the IFS header info in Windows to see how
Windows lacks any buffer size info in what is passed into many security
critical calls. The insecurity is not bolted on there; it's baked in
and well mixed.

Arguments are optional if they are ignorable by the called routine, and
not otherwise. The VMS convention is that a null in an argument not passed
by value means the argument is missing. Note VMS normally maps the first
address page as an illegal address area to avoid troubles.

Andrew Allison wrote:
> Hello:
>
> Yes. As far as my memory goes, I believe all VMS optional arguments are at
> the end and if you need to skip one argument to get to the other then a Null
> or something is required. Now you've got me thinking...
>
> Would it be a null pushed on the stack since that indicated the end of
> variable list or is it something else?
>
> On the stack is pushed an argument count, but is that incorporated into C's
> variable arguments
>
> i.e. Can you skip over an argument to get to the next one?
>
> Or was VMS designed such that there would not be a need to skip arguments to
> get to the next one?
>
> If yes what is in it's place?
>
> OK I'm stumped :-)
>
> Well, I guess I'll worry about that one when I run into it.
>
> Andrew
>
>
> -- Attached file included as plaintext by Listar --
>
> Reply-To: <freevms@ml.free.fr>
> From: "Geoffrey Pratt" <geoff@genna.demon.co.uk>
> To: <freevms@ml.free.fr>
> References: <001b01c3ccd1$3b1d1a20$4600000a@allison.com>
> Subject: [FreeVMS] Re: Null Termination & Optional Arguments
> Date: Sat, 27 Dec 2003 18:37:43 -0500
> Message-ID: <20031227.23374300.273126571@imagnu.geo>
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: 8bit
> X-Priority: 3 (Normal)
> X-MSMail-Priority: Normal
> X-Mailer: Mozilla/3.0 (compatible; StarOffice/5.2;Linux)
> X-listar-version: Listar v0.42
> X-original-sender: geoff@genna.demon.co.uk
> X-list: freevms
> In-Reply-To: <001b01c3ccd1$3b1d1a20$4600000a@allison.com>
> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
> Importance: Normal
>
> Yo,
>
> If the optional arguments are not at the end, then something has to
> pushed onto the stack - it does not matter what language one is using -
> The syntax may differ between languages, but at the machine code level, I
> believe, there will be a 32-bit zero pushed onto the stack. In C, that
> would be a NULL pointer (or an integer of zero, depending on the context
> [data-type])
>
> Geoff.
>
>
>>>>>>>>>>>>>>>>>>>Original Message <<<<<<<<<<<<<<<<<<
>
>
> On 27/12/03, 23:29:10, "Andrew Allison" <freevms@sympatico.ca> wrote
> regarding [FreeVMS] Null Termination & Optional Arguments:
>
>
>
>>Hello:
>
>
>> Just to let you know, I using the C style variable arguments in the
>
> run
>
>>time libraries I'm writing. The parameter may or may NOT be there. I not
>>assuming that there will be null filled parameter lists. For example I
>
> just
>
>>finished str$find_first_substring which can have any number of trailing
>>arguments. i.e there is no finite number specified. I think the NULL
>
> place
>
>>holder is a requirement determined by the programming language used.
>
>
>>source, index, subindex, substring, [...substring]
>
>
>>( Just don't ask me if that was correct BNF syntax)
>
>
>>Survey time
>
>
>>Language Null filled
>>------------------------------
>>DCL Yes / Comma's
>>Cobol Comma's
>>C No
>>Fortran Can't remember
>>Assembly No
>
>
>
>>As a foot note I had some bizarre behavior in the operation of va_arg
>
> where
>
>>null was not passed onto the stack correctly.
>
>
>>Now, to spice things up somewhat with null terminated strings.
>
>
>>I've combine the descriptor / counted string VMS concept with the Null
>>terminated string concept.
>>I'm presuming that a little re-writing will be required when FreeVMS
>>progresses a little further.
>
>
>>A: Since we are writing in C under Linux, strings are null terminated
>
> and
>
>>I haven't written / or seen a printf scanf routine that handles string
>>descriptors.
>
>
>>B: I been a little concerned about the use of the linux C string
>
> function
>
>>calls since they all expect null termination, but I hope when we write
>
> the C
>
>>compiler these little problems will go away :-)
>
>
>>Andrew
>
>
>
>
>>--
>>Liste de diffusion FreeVMS
>>Pour se désinscrire :
>
> mailto:freevms-request@ml.free.fr?subject=unsubscribe
>
>
>>
>
> --
> Liste de diffusion FreeVMS
> Pour se désinscrire : mailto:freevms-request@ml.free.fr?subject=unsubscribe
>
>
>
>
>

-- 
Liste de diffusion FreeVMS
Pour se désinscrire : mailto:freevms-request@ml.free.fr?subject=unsubscribe



This archive was generated by hypermail 2b25 : Sun Dec 28 2003 - 04:23:24 CET