3 ms·
I agree with the criticism that one should not mimick C++ in C. A good C library would use intrusive data structures, user-controlled memory allocations, not t
by uecker 3y ago
I agree with the criticism that one should not mimick C++ in C.
A good C library would use intrusive data structures, user-controlled memory allocations, not try to replace built-in types (arrays) with inferior alternatives, and not to try to be a kitchen-sink library.
And then it would be obvious such C++ sucks in comparison... ;-)
- gpderetta 3y ago> intrusive data structures, user-controlled memory allocations That's par for the course in c++. > not try to replace built-in types (arrays) How do you pass around C arrays to avoid the braindead pointer decay? You wrap them in a struct. That's literally all that std::array does.
- uecker 3y agoYou do not need to wrap arrays into structs to prevent decay. You just take the address as you would do for any other type: https://godbolt.org/z/Y73j8a7Yf https://godbolt.org/z/Y73j8a7Yf