Comment by thayne
7 days ago
Is there anything in here for something like a "slice" or dynamically sized array that carries its length along with it?
7 days ago
Is there anything in here for something like a "slice" or dynamically sized array that carries its length along with it?
Just use compiler option -std=c++20 and use std::span. Don't try reinventing it in C.
If someone needs more than C provides, why on earth would they choose C++?
No rational person is going to want to have to deal with 10x the number of foot guns.
Literally anything when moving from C is better than C++.
Switching to C++ is relatively easy in an existing codebase. It's in many cases as simple as renaming a file from .c to .cpp. But for writing something from scratch it's better to use Rust.
4 replies →
std span is not bounds checked.
It is when enabling the respective compiler switches for hardned standard library.
Even better in C++26.