C++ Logo

std-discussion

Advanced search

Re: Type requirements for va_start

From: Brian Bi <bbi5291_at_[hidden]>
Date: Mon, 5 Jun 2023 21:35:27 -0400
On Tue, Apr 25, 2023 at 5:34 PM Edward Catmur via Std-Discussion <
std-discussion_at_[hidden]> wrote:

>
>
> On Tue, 25 Apr 2023 at 14:39, Thiago Macieira via Std-Discussion <
> std-discussion_at_[hidden]> wrote:
>
>> On Tuesday, 25 April 2023 11:53:46 PDT Lukas Barth via Std-Discussion
>> wrote:
>> > At this point I'm at my wit's end. How is that rule to be interpreted?
>>
>> Why are you trying to interpret it? Can't you just assume that if the
>> type
>> isn't a trivial scalar, it can't be passed?
>>
>
> An enum is a trivial scalar.
>
> > Could it be that this use of "compatible" in `[stdarg.syn]/1.2` was
> grandfathered in from C, but is not defined anymore?
>
> Yes.
>

It seems that we need to open an LWG issue about this. "Compatible" is
indeed not defined and we cannot simply assume that it means what it means
in the C standard, because not every C++ type is a valid C type, meaning
that it would not be clear how to apply the definition from C.

Lukas, please email lwgchair_at_[hidden] to submit an LWG issue. If you don't
have time to do it, I can do it for you.


>
> > What is "the type that results when passing an argument for which
> there is no parameter"?
>
> See http://eel.is/c++draft/expr.call#11.sentence-1 . In other words, you
> can use a parameter as the second argument to va_start if it is a type such
> that you could retrieve it from ellipsis using va_arg (i.e., if there was a
> preceding parameter).
>
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>


-- 
*Brian Bi*

Received on 2023-06-06 01:35:42