C++ Logo


Advanced search

Re: Type requirements for va_start

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Tue, 25 Apr 2023 16:33:47 -0500
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?


> 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).

Received on 2023-04-25 21:34:00