How is it not clear by my using ONLY standard C library headers that I am NOT trying to write "modern C++"?
The STL has its uses…when you're writing a high level program, for example, that queries a database or when you need to pivot matrices for rendering some graphics. But if you're writing a string manipulating function that's presumably going to be called tons of times, it makes no sense to draw in big monsters like the STL. It's like bringing a jackhammer to nail a picture on drywall.
As for manual memory management, this is C++, not Python. If you're willing to use smart pointers, then you shouldn't even be using C++ because that sacrifices determinism and performance just as much or more than GC. If I wanted that kind of software, I would just use a much quicker-to-write language like Java/Go/CL.
When you're writing a string manipulation function that is called a lot of times you also don't allocate memory. And GC isn't necessarily slower than manual memory management. And std::unique_ptr is never slower than manual memory management, since it does exactly the same thing.
4 comments
[ 4.6 ms ] story [ 17.8 ms ] threadEdit : I actually did a PR on the code. Wait & see
- Manual memory management
- NULL-terminated strings instead of std::string and/or a string_view class
The STL has its uses…when you're writing a high level program, for example, that queries a database or when you need to pivot matrices for rendering some graphics. But if you're writing a string manipulating function that's presumably going to be called tons of times, it makes no sense to draw in big monsters like the STL. It's like bringing a jackhammer to nail a picture on drywall.
As for manual memory management, this is C++, not Python. If you're willing to use smart pointers, then you shouldn't even be using C++ because that sacrifices determinism and performance just as much or more than GC. If I wanted that kind of software, I would just use a much quicker-to-write language like Java/Go/CL.