I’m learning C++ coming from doing JavaScript professionally for years. I know the differences between signed and unsigned, but I’m not sure I understand why they even exist. Is it for performance or something?
I’m learning C++ coming from doing JavaScript professionally for years. I know the differences
Share
Because they’re needed.
signedtypes exist because sometimes one wants to use negative numbers.unsignedtypes exist because for some operations, e. g. bitwise logic and shifting, they’re cleaner to use (e. g. you don’t have to worry about how the sign bit is represented, etc.)