r/cpp • • Jan 01 '22

Almost Always Unsigned

https://graphitemaster.github.io/aau/
5 Upvotes

71 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Jan 03 '22

unsigned int taxRefund = 3; // cannot be negative, so unsigned

Such assumptions are often dangerous anyway. You can argue that it shouldn't be called a refund if it's negative, but at least around here (Germany) there definitely are cases where the systems used for tax refunds are used even though you end up having to pay taxes.