News for hackers. Stuff that matters.
Re:3rd Edition of Programming: Principles and Practice Using... by jbandela1 on Friday April 19, 2024 @01:11PM (#40089374)
>Maybe take a shot at parsing JSON in C++ and see if the nostalgia survives the process.

I have used this library in the past and was actually pretty easy

https://github.com/nlohmann/json

Re:3rd Edition of Programming: Principles and Practice Using... by celie56 on Friday April 19, 2024 @03:39PM (#40091136)
Your recommended json solution was also my first thought but if you do not have the ability to easily introduce a new dependency then the op is correct.

If I have an existing JSON file that I want to quickly parse for a demo project there is almost zero chance I would pick C++. In comparison, Python is already installed in many environments and has built-in json parsing.

Re:3rd Edition of Programming: Principles and Practice Using... by JonChesterfield on Saturday April 20, 2024 @03:43AM (#40095564)
A mere 25k lines of self contained C++, bundled in a single header as the one true distribution format. I note the CI cmake script at a thousand lines of cmake. That's a very idiomatic representation of a C++ library, thank you for the example.
Re:3rd Edition of Programming: Principles and Practice Using... by SubjectToChange on Saturday April 20, 2024 @05:35AM (#40096046)
A mere 25k lines of self contained C++,…

Oh come on now, about 7.5k of those lines are comments and/or blank lines. Furthermore, a good chunk of the code is devoted to type checking, thorough error handling, compiler compatibility and/or workarounds, etc, all within the restrictions of C++11.

… bundled in a single header as the one true distribution format.

Yes, build systems are a significant pain point for C++ and C. Many users prefer to largely avoid the issue and use header-only libraries. That said, Conan and vcpkg are making genuine strides at improving the issue.

I note the CI cmake script at a thousand lines of cmake.

This is ridiculous. It’s a CI script running multiple test suites over dozens of compiler versions, of course it’s going to be a lot. Would it make you feel better if that CI script didn’t exist? If not, then what’s the “correct” size for CI script?

That's a very idiomatic representation of a C++ library, thank you for the example.

The library is genuinely good. It’s portable, well tested, user friendly, and widely supported. Your snark is unwarranted.