Topic: Q: va_end in C++?


Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Sun, 28 Nov 1993 23:15:02 GMT
Raw View
In article <CGvLEo.wD@ses.com> jamshid@ses.com (Jamshid Afshar) writes:
>In article <rfgCGsB6F.DM2@netcom.com>,
>Ronald F. Guilmette <rfg@netcom.com> wrote:
>>>This *should* cause no problem.  As far as I know, stdarg.h has been
>>>taken over from C with no changes.
>>
>>Ah! But you see, that's *exactly* the problem!
>>In the ISO C standard (7.8.1) it says:
>> "The va_start and va_end macros shall be invoked in the FUNCTION
>> accepting a varying number of arguments..."
>>(Emphasis added.)
>>Please note that this passage doesn't say a darn thing about C++ *member*
>>functions!
>
>The term "function" includes member functions.

Jamshid, I do not share your view in this case.

In general, it appears to me that both the ARM and current X3J16 working
paper are very explicit in specifying whether any given rule applies to
either "functions" or "member functions".  I do not think that the latter
is considered a subset of the former.  Rather, the ARM and the X3J16 WP
seem (in general) to treat these as two entirely disjoint sets.

--

-- Ronald F. Guilmette, Sunnyvale, California -------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------




Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Sat, 20 Nov 1993 09:47:03 GMT
Raw View
In article <KANZE.93Nov18152830@slsvhdt.us-es.sel.de> kanze@us-es.sel.de (James Kanze) writes:
>In article <753567880snz@mayfair.demon.co.uk>
>alain@mayfair.demon.co.uk (Allen) writes:
>
>|>         I have a question regarding va_lists in C++.
>
>|> [... example deleted...]
>
>|> Question 1: Can I do this in C++ [notice the virtual functions] or do I have
>|> to allow for the _this_ pointer in va_start()?
>
>This *should* cause no problem.  As far as I know, stdarg.h has been
>taken over from C with no changes.

Ah! But you see, that's *exactly* the problem!

In the ISO C standard (7.8.1) it says:

 "The va_start and va_end macros shall be invoked in the FUNCTION
 accepting a varying number of arguments..."

(Emphasis added.)

Please note that this passage doesn't say a darn thing about C++ *member*
functions!

(Translation:  Yet another thing that X3J16 needs to work on.)

--

-- Ronald F. Guilmette, Sunnyvale, California -------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------




Author: jamshid@ses.com (Jamshid Afshar)
Date: Mon, 22 Nov 1993 04:20:47 GMT
Raw View
In article <rfgCGsB6F.DM2@netcom.com>,
Ronald F. Guilmette <rfg@netcom.com> wrote:
>>This *should* cause no problem.  As far as I know, stdarg.h has been
>>taken over from C with no changes.
>
>Ah! But you see, that's *exactly* the problem!
>In the ISO C standard (7.8.1) it says:
> "The va_start and va_end macros shall be invoked in the FUNCTION
> accepting a varying number of arguments..."
>(Emphasis added.)
>Please note that this passage doesn't say a darn thing about C++ *member*
>functions!

The term "function" includes member functions.  9.3: "A function
declared as a member ... is called a member function."  Furthermore,
constructors and destructors are just special kinds of member
functions.

ARM 8.2.5 Functions: "The standard header <stdarg.h> contains a
mechanism for accessing arguments passed using the ellipsis."  8.2.5's
discussion of functions includes member functions.  For example, "A
cv-qualifier-list can be part of a declaration or definition of a
nonstatic member function...".

Jamshid Afshar
jamshid@ses.com