-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
How to output Pointer #1492
Comments
spdlog use fmt library to format argument at runtime. int nP = 3;
SPDLOG_LOGGER_INFO(g_pLogger, "&nP={}", fmt::ptr(&nP)); |
OK , thank you! |
Code:
Output: @tt4g Why the result isn't the pointer address? |
@caibf Set pointer syntax HWND hwnd_child = viewer->GetWindowId();
- KL_LOGGER_DEBUG("Create the visualizer viewer({}).", fmt::ptr(hwnd_child));
+ KL_LOGGER_DEBUG("Create the visualizer viewer({:p}).", fmt::ptr(hwnd_child)); And it is recommended that this question be asked in the fmt repository. |
I have tried this, still the same result. Maybe the fmt version(I use spdlog 1.5.0, depends on fmt 6.1.2) problem. But make a simple demo, result it's ok.
Output:
OK. I will move this question to its repository. |
int nP = 3;
SPDLOG_LOGGER_INFO(g_pLogger, "&nP={}", &nP);
core.h:902:5: error: static assertion failed: formatting of non-void pointers is disallowed
static_assert(!sizeof(T), "formatting of non-void pointers is disallowed");
How to output a Pointer?
The text was updated successfully, but these errors were encountered: