Skip to content

Support printing (const) volatile void* - #4056

Merged
vitaut merged 1 commit into
fmtlib:masterfrom
Arghnews:volatile_void_pointer_support
Jul 10, 2024
Merged

Support printing (const) volatile void*#4056
vitaut merged 1 commit into
fmtlib:masterfrom
Arghnews:volatile_void_pointer_support

Conversation

@Arghnews

@Arghnews Arghnews commented Jul 7, 2024

Copy link
Copy Markdown
Contributor

Fixes #4049

@Arghnews
Arghnews force-pushed the volatile_void_pointer_support branch from 13860e8 to 63fb57c Compare July 7, 2024 21:18
Comment thread test/base-test.cc Outdated
Comment on lines +429 to +440
auto check = [](const int val) {
CHECK_ARG(
char, reinterpret_cast<const void*>(val),
static_cast<volatile void*>(reinterpret_cast<volatile int*>(val)));
CHECK_ARG(char, reinterpret_cast<const void*>(val),
static_cast<const volatile void*>(
reinterpret_cast<const volatile int*>(val)));
};
check(0);
check(1);
check(2);
check(0xbeef);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to check various values here, let's get rid of the lambda and just check nullptr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just being safe to cover the behaviour with iostreams linked in https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1147r1.html but if you're happy for it to be removed I'll take it out

@Arghnews
Arghnews force-pushed the volatile_void_pointer_support branch from 63fb57c to cc5e38f Compare July 9, 2024 20:04