Subject: [FreeVMS] Re: Null Termination & Optional Arguments
From: Geoffrey Pratt (geoff@genna.demon.co.uk)
Date: Sun Dec 28 2003 - 00:37:43 CET
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
This archive was generated by hypermail 2b25 : Sun Dec 28 2003 - 01:14:35 CET