C++ Logo

std-proposals

Advanced search

Re: [std-proposals] scoped enums and varargs

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 23 Feb 2024 23:51:14 +0200
On Fri, 23 Feb 2024 at 23:45, Jonathan Wakely via Std-Proposals
<std-proposals_at_[hidden]> wrote:

>
> But for printf, you get undefined behaviour, because printf doesn't
> know how to extract that type and it expects an int, a double, a
> pointer, or whatever.

..or implementation-defined extensions for passing other types via varargs, even
types that aren't trivially copyable.

But regardless of that, this

> cases" or "static_cast<int>() in all your debug printf()s" :-(

is the right thing to do, and there's no need to frown about it.
That's how scoped enums
work, by design, that's how they're intended to work.

Received on 2024-02-23 21:51:27