r/cpp • • Sep 16 '17

Useful GCC warning options not enabled by -Wall -Wextra

https://kristerw.blogspot.com/2017/09/useful-gcc-warning-options-not-enabled.html
164 Upvotes

71 comments sorted by

View all comments

Show parent comments

4

u/dodheim Sep 18 '17

you can't assert or check that the desired "invariant" has been maintained

Yes, you can. You may not want to (or at least want to have to), but > is not a secret.

1

u/zvrba Sep 20 '17

For that to be useful, we'd need max_capacity for containers, which would return size_t(-1) / sizeof(T).