5 ms·
What does “Classic C++” mean?
by makz 2y ago
What does “Classic C++” mean?
- pbrowne011 2y ago"Classic C++" and "Modern C++" refer to the language before and after C++11, respectively. Some of the key differences are use of standard library and its containers, smart pointers, and other language features that look less like C. In this specific library, this refers to some of the techniques like bit manipulation, manual memory management and string parsing, and using things like enums to improve speed and reduce complexity. An example of a more robust (but still "classic") library would be something like https://github.com/Tencent/rapidjson https://github.com/Tencent/rapidjson.
- jll29 2y agoThis library is nicely concise, and the code is mostly readable (although there are some non-obvious tricks that could be better documented). The Makefile could need some work: json_test.cpp:360:23: warning: missing terminating '"' character [-Winvalid-pp-token] { Json::success, R"({ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 9 warnings and 20 errors generated. make: *** [json_test.o] Error 1 % c++ --version Apple clang version 15.0.0 (clang-1500.1.0.2.5) Target: arm64-apple-darwin22.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin Compiling direclty with c++ --std=c++11 -c json.cpp works fine, though.
- jandrewrogers 2y agoThere are approximately three major dialects of C++. They are distinguished by major changes in what idiomatic code looks like, enabled by the addition of core features to the language that made it more efficient and type-safe to express many things. The era of so-called “modern” C++ started with C++11, which was a radical reworking of the language. All prior versions of C++ are “legacy” or “classic”. Idiomatic code in “modern” and “classic” dialects almost look like different languages. C++20 arguably marks a new dialect break but it doesn’t have a colloquial label to distinguish it from “legacy” and “modern” AFAIK. Idiomatic C++20 looks pretty foreign from a C++11 perspective (but is unambiguously an improvement).
- deleted 2y ago[deleted]
- jart 2y agoThis library supports building with C++11. I haven't tried compiling it with an older standard, but I imagine it might work. One thing I like about the C++11 compilers like GCC 4.9 is they build code magnificently faster than recent editions. See https://x.com/JustineTunney/status/1795427808631758936 https://x.com/JustineTunney/status/1795427808631758936
- aninteger 2y ago> This library supports building with C++11. I haven't tried compiling it with an older standard, but I imagine it might work. I believe it does require C++11, due to std::nullptr_t and r-value references (&&), but that might be it. It's not a show stopper though since everyone should have a c++11 compiler now (even Ubuntu 14.04 LTS, which still has paid support I believe). > One thing I like about the C++11 compilers like GCC 4.9 is they build code magnificently faster than recent editions Kind of reminds me of gcc 2.95 which people kept around for the compiler speed. They would use gcc 3.x for the warning support and then compile with gcc 2.95 after fixing the warnings :).
- jart 2y agoYes they'd be very trivial to remove locally. It might also be nice to have #ifdef statements around them like we're already doing for std::string_view. If we consider that many big name C projects like curl are still on C89 then there's surely got to be people still out there using 2000's era C++.
- chipdart 2y ago> It's not a show stopper though since everyone should have a c++11 compiler now (...) I think the point of pointing out it's C++11 is that it's not "classic C++" as it's using "modern C++" features. Thus it's a mystery why it would be referred to as classic C++.