News for hackers. Stuff that matters.
Re:Build Your Own Redis with C/C++ by JTyQZSnP3cQGa8B on Saturday March 18, 2023 @05:17PM (#35213201)
It seems to be a nice project but they should remove "C++" from the name since both languages have nothing in common anymore, especially the use of smart pointers and Boost.Asio compared to "malloc and socket" that is used in the book.
Re:Build Your Own Redis with C/C++ by hewlett on Saturday March 18, 2023 @05:33PM (#35213313)
You can still use raw pointers and sockets in C++, which the code examples provided in the book do
Re:Build Your Own Redis with C/C++ by JTyQZSnP3cQGa8B on Saturday March 18, 2023 @05:54PM (#35213473)
I agree but no one calls this C++ anymore especially since C++14/17, and I fail to see why you would use a C++ compiler for such a code.
Re:Build Your Own Redis with C/C++ by gpderetta on Saturday March 18, 2023 @05:57PM (#35213492)
Well, if you are implementing something like ASIO, and of course c++ is a good language for that, you'll be dealing with sockets directly.
Re:Build Your Own Redis with C/C++ by _gabe_ on Saturday March 18, 2023 @07:15PM (#35214193)
> I agree but no one calls this C++ anymore especially since C++14/17

I do. Who's to say if you use C++, thou shalt always use: smart pointers, move semantics, OOP, templates, and more. Also, you're discounting a very large and very real industry of people writing code for embedded hardware that doesn't necessarily have the luxurious memory resources modern devices have.

Why could I ever possibly want to use C++ if I don't want to use smart pointers and OOP and all that other stuff? Well, generic type safety is very nice. Templates don't exist in C. Constexpr and references are also quite nice. They allow me to annotate my code to make my intentions clearer. Operator overloading is also insanely helpful at times. Matrix/vector math is so much nicer to write/read using mathematical operators instead of function calls everywhere. This also isn't possible in C.

Anyways, don't go making claims that if somebody doesn't use a language exactly the same way you do, then they're using it wrong. Especially when it's a language as massively overengineered as C++. There are plenty of reasons to prefer a subset of C++ to C, and plenty of valid reasons to prefer to use C instead of dealing with the complexities of C++.

Re:Build Your Own Redis with C/C++ by batty_alex on Saturday March 18, 2023 @11:30PM (#35215746)
The article doesn’t use any C++ features, though. It’s straight C code. Pretty sure that’s what they meant
Re:Build Your Own Redis with C/C++ by Arelius on Saturday March 18, 2023 @06:44PM (#35213937)
I'm starting to understand there are clearly 2 different worlds, if you live in one where C++ assumes the use of smart pointers, or especially Boost.

In the C++ world I live/work Boost is avoided like the plague. I always wondered how Boost continues to exist, but it seems in certain communities it's held up as a standard to strive for.

Re:Build Your Own Redis with C/C++ by mianos on Saturday March 18, 2023 @07:32PM (#35214312)
I think in the even more modern world, there is also the use of post C++17 smart pointers and still avoiding boost if at all possible. Personally I have grown a little softer on it now that adding boost does not take an application that took a few minutes to build to one that takes an hour.
Re:Build Your Own Redis with C/C++ by stonemetal on Saturday March 18, 2023 @11:16PM (#35215685)
More than half a dozen Boost libraries have made their way to the standard.

Boost continues to exist because there is large overlap with the standards committee and they use it as a staging ground to try out new ideas before they are standardized.