C++ Logo

sg16

Advanced search

Re: [isocpp-lib-ext] LEWG(I) (Bi)Weekly review - P2510R0: Formatting pointers

From: Zhihao Yuan <zy_at_[hidden]>
Date: Fri, 11 Feb 2022 02:12:01 +0000
On Thursday, February 10th, 2022 at 3:40 PM, Inbal Levi via Lib-Ext <lib-ext_at_[hidden]> wrote:

> P2510R0: Formatting pointers
> From the Abstract:
> [...] This paper aims to make formatting pointer types more useful, reducing the need for users to write their own formatters or casting a pointer type to an integer type.

The argument "pointer types should
share the same amount of formatting
options as as integers" is undefended.

To explain what do I mean -- I have
a stronger need for seeing

  std::println("at {:?p}", p); // '?' is introduced in http://wg21.link/p2286.

output:

  at 00007ffb`a67fb331 myLib!myNs::SomeCls

Address is an identity of object in C++,
so when printing an address, I want to
see what is there. I hope we can build
the understanding of pointers != integers
after http://wg21.link/p2318 (provenance-
aware memory object model).

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

Received on 2022-02-11 02:12:04