Paavo Helde wrote:
Hendrik Schober <spamtrap@gmx.de> kirjutas:
[...]
Why 'int'? Will there ever be a sequence of -5 bytes?
We have had this discussion before in this group, several times.
I'm sorry I missed this. I'm not a regular reader. I don't
have enough time to be. Feel free to ignore any discussion
stemming from this.
In
C++, the unsigned types are quite specific types with special rollover
effects and there are tricky promotion rules for mixed-signedness
arithmetic expressions. Unless unsignedness is strongly needed, I
would avoid those types.
Well, call me strict, but I happen to believe that, for
specifying sizes, unsignedness is strongly needed. I also
believe that, if a positive value is needed in order to
call a function, the function's interface should say so.
Yes, I know, implicit promotion etc. can wreak havoc when
you have huge unsigned numbers.
In C or C++, unsigned type is far more likely to yield "funny errors".
Choosing types in a good way is a matter of programming language.