on the use of char
Frans Englich
frans.englich at telia.com
Thu Jul 29 14:58:44 BST 2004
On Thursday 29 July 2004 02:04, George Staikos wrote:
> Hi folks,
>
> I'd like to point out that we need to be careful about the use of "char"
> for storing numbers in KDE. Some platforms have unsigned char type, others
> have signed char type. I happen to have both. Consequently I have seen,
> on a regular basis, broken KDE applications on one or both of my machines
> due to code that assumes signedness or unsignedness of char. Yes, I have
> also implemented this bug before.
>
> So if your goal is to store a relatively small number and not waste
> space, can I recommend either using a bitfield int, or thinking again "is
> it really worth the possible bugs in order to save 3 bytes out of, ex.,
> ~5MB"?
>
> (really, explicitly specifying the signedness may only help half of the
> cases I've seen. don't go there...)
This is perhaps something for the Common Mistakes Doc:
http://developer.kde.org/documentation/other/mistakes.html
Frans
More information about the kde-core-devel
mailing list