Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't print volatile void* #4049

Closed
ZXShady opened this issue Jul 2, 2024 · 5 comments · Fixed by #4056
Closed

can't print volatile void* #4049

ZXShady opened this issue Jul 2, 2024 · 5 comments · Fixed by #4056

Comments

@ZXShady
Copy link

ZXShady commented Jul 2, 2024

this is the same issue with std::ostream operator that will be fixed in C++23

godbolt

@Dani-Hub
Copy link
Contributor

Dani-Hub commented Jul 3, 2024

What the submitter is referring to is the adopted paper P1147.

@vitaut
Copy link
Contributor

vitaut commented Jul 3, 2024

Since {fmt} disallows arbitrary pointers you still need a cast in which case volatile can be omitted. Is there a more compelling example?

@Dani-Hub
Copy link
Contributor

Dani-Hub commented Jul 3, 2024

Since {fmt} disallows arbitrary pointers you still need a cast in which case volatile can be omitted. Is there a more compelling example?

I think a more compelling example is that you have actually a volatile T* p for formatting, but it doesn't suffice to add apply static_cast<const void*> to p in your code, but you also need to add another const_cast<const T*> to it first.

@ZXShady
Copy link
Author

ZXShady commented Jul 4, 2024

@vitaut

lets say I have a volatile int* and want to format it I have to do this

volatile int* p = (int*)0xdeadbeef;
fmt::format("{}",const_cast<void*>(static_cast<volatile void*>(p))); // or do static_cast<void*>(const_cast<int*>(p))

if fmt allowed to print const volatile void* then I do not need the last const cast.

the godbolt link was to show that you can't print it

@vitaut
Copy link
Contributor

vitaut commented Jul 4, 2024

Makes sense, a PR to avoid volatile void* support would be welcome.

Arghnews added a commit to Arghnews/fmt that referenced this issue Jul 7, 2024
Arghnews added a commit to Arghnews/fmt that referenced this issue Jul 7, 2024
Arghnews added a commit to Arghnews/fmt that referenced this issue Jul 9, 2024
Arghnews added a commit to Arghnews/fmt that referenced this issue Jul 9, 2024
vitaut pushed a commit that referenced this issue Jul 10, 2024
mtremer pushed a commit to ipfire/ipfire-2.x that referenced this issue Aug 15, 2024
- Update from version 11.0.1 to 11.0.2
- Update of rootfile
- Changelog
    11.0.2
	- Fixed compatibility with non-POSIX systems
	  (fmtlib/fmt#4054,
	  fmtlib/fmt#4060).
	- Fixed performance regressions when using `std::back_insert_iterator` with
	  `fmt::format_to` (fmtlib/fmt#4070).
	- Fixed handling of `std::generator` and move-only iterators
	  (fmtlib/fmt#4053,
	  fmtlib/fmt#4057). Thanks @Arghnews.
	- Made `formatter<std::string_view>::parse` work with types convertible to
	  `std::string_view` (fmtlib/fmt#4036,
	  fmtlib/fmt#4055). Thanks @Arghnews.
	- Made `volatile void*` formattable
	  (fmtlib/fmt#4049,
	  fmtlib/fmt#4056). Thanks @Arghnews.
	- Made `Glib::ustring` not be confused with `std::string`
	  (fmtlib/fmt#4052).
	- Made `fmt::context` iterator compatible with STL algorithms that rely on
	  iterator category (fmtlib/fmt#4079).

Signed-off-by: Adolf Belka <[email protected]>
Signed-off-by: Michael Tremer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants