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

Fix the snprintf string to use the correct size format specifier #3388

Merged
merged 1 commit into from
Oct 10, 2019

Conversation

kunaltyagi
Copy link
Member

llu -> lu

@taketwo
Copy link
Member

taketwo commented Sep 29, 2019

According to git blame we used to have lu, but that was changed 3 months ago: 7d0ee47

@kunaltyagi
Copy link
Member Author

The issue might be 32 bit vs 64 bit for the size. In that case some other solution is needed

@kunaltyagi
Copy link
Member Author

Found this in the reference

@taketwo
Copy link
Member

taketwo commented Oct 9, 2019

Never seen something like this in the wild!

GCC seems to have a problem:

outofcore/src/visualization/viewport.cpp:184:39: error: unable to find string literal operator 'operator""PRIu64' with 'const char [14]', 'long unsigned int' arguments
             "%"PRIu64" points/%"PRIu64" mb", points_loaded, data_loaded/1024);

Maybe #include <inttypes.h> is needed?

@kunaltyagi
Copy link
Member Author

Never seen something like this in the wild!

Yeah. I was just randomly searching when I read on SO that "zu" is specified for size_t which triggered me to read the reference page for "z".

Maybe #include <inttypes.h> is needed?

Yeah, didn't notice that small print

@taketwo taketwo merged commit d160194 into PointCloudLibrary:master Oct 10, 2019
@kunaltyagi kunaltyagi deleted the format_warn branch October 10, 2019 12:39
@taketwo
Copy link
Member

taketwo commented Oct 11, 2019

[ 56%] Building CXX object outofcore/tools/CMakeFiles/pcl_outofcore_process.dir/outofcore_process.cpp.o
/__w/1/s/outofcore/src/visualization/viewport.cpp:185:13: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
             "%"PRIu64" points/%"PRIu64" mb", points_loaded, data_loaded/1024);
             ^
/__w/1/s/outofcore/src/visualization/viewport.cpp:185:22: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
             "%"PRIu64" points/%"PRIu64" mb", points_loaded, data_loaded/1024);
                      ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants