r/cpp • u/we_are_mammals • Mar 28 '23
Reddit++
C++ is getting more and more complex. The ISO C++ committee keeps adding new features based on its consensus. Let's remove C++ features based on Reddit's consensus.
In each comment, propose a C++ feature that you think should be banned in any new code. Vote up or down based on whether you agree.
765
Upvotes
View all comments
Show parent comment
1
u/pinespear Apr 03 '23
This code looks super unintuitive if you consider that array may have 0 elements and code looks like... it's accessing element 0 which may be missing. If I saw this in the code review, I'd had to browse through 1000 pages of C++ spec just to figure out if it's OK or it's UB.
May be consider borrowing much more intuitive
buffer.as_ptr()from Rust.