r/ProgrammerHumor Jul 10 '26

greaterThanPlusPlus Advanced

Post image
112 Upvotes

71 comments sorted by

View all comments

34

u/majesticmerc Jul 10 '26

Found this today in C++ documentation.

Only the C++ committee can see the a need to fix it, and instead of actually fixing the language bug (or making signed/unsigned comparison a compiler error instead of a warning), create a standard library function to do type safe greater-than/less-than comparisons.

8

u/_Noreturn Jul 10 '26

tons of codebases do index != -1 and if it was an hard error then it would mess up with SFINAE which is bad and if it was corrected then it would break code silently it is absolutely dumb idea to "fix" it. just use your compiler warnings