eranif / codelite

A multi purpose IDE specialized in C/C++/Rust/Python/PHP and Node.js. Written in C++
https://codelite.org
GNU General Public License v2.0
2.09k stars 448 forks source link

Fix warning about `printf`: #3419

Closed Jarod42 closed 4 days ago

Jarod42 commented 1 week ago
Eric-01 commented 1 week ago

Why not %zu instead? :)

Jarod42 commented 1 week ago

Not familiar enough with printf format. I know that std::size_t might be of different size, warning suggests %ld as fix, so wrong for other size. Not sure neither if %zu is supported by all compiler...

AJenbo commented 1 week ago

Testing via GodBolt it seems it should be supported on: Clang 5, GCC 5, djgpp 5.5, icc 16, icx 2021, MSVC 19, nvc++ 22, FRC, TI CL430, Zapcc

It appears that it's more common for compilers to not support C++17 then %zu.