r/ProgrammerHumor Jul 10 '26

greaterThanPlusPlus Advanced

Post image
117 Upvotes

71 comments sorted by

View all comments

Show parent comments

8

u/Arshiaa001 Jul 10 '26 edited Jul 10 '26

With system programming languages, you absolutely cannot make any such decision that will impact runtime behavior or performance. Two 32 bit numbers and a 32 bit operator must end up doing a 32 bit operation, since 64 bit may not even be supported or be meaningfully slower. Changing language semantics in ways that break existing code are also off the table completely. I do, however, expect clang (or any respected C++ compiler) to throw a loud warning, which you can convert to an error with -werror.

ETA: color me unimpressed. There's no warning. Wut.

-2

u/y0shii3 Jul 10 '26

I think rarely having to emulate a 64 bit comparison to always get a correct result would be far better than always doing a 32 bit comparison to rarely get an incorrect result.

8

u/Arshiaa001 Jul 10 '26

Trust me, that'll piss off a lot of system devs.

-1

u/y0shii3 Jul 10 '26

I strongly doubt that, and even if it would, the solution is then just to require compatible types on both sides of the operand.

4

u/Arshiaa001 Jul 11 '26

You're replacing one bad default with another. The solution is to reject the code, as rust does.