Discussion:
Compiler warnings / clean ups; Strings
Alex Hudson
2009-07-12 09:18:54 UTC
Permalink
Hey all,

I just committed some fixes to Store to make it compile cleanly with
StrictCompile() turned on in the CMakeLists.txt. There are a couple of
genuine bugs fixed in there, many of the warnings are obsolete code
which needs to be fixed up properly though.

One big source of warnings is signed char vs. unsigned char. I think we
really need to have a look at this, in particular because I'm sure there
are bugs hiding in there.

Just to explain the problem; the 'char' type could be unsigned or signed
(it's platform specific, but often signed) and most system functions
take char * arguments. However, throughout Bongo, there is a lot of use
of unsigned char.

The signedness is often specified because if you want to compare
characters in strings you need to have an idea of the sign, e.g. (char
character > 'a') could evaluate differently if 'character' is signed or
unsigned.

Additionally, use of char is kind of a problem anyway: it means we don't
handle UTF-8 in most instances.

I'm thinking that we'd mostly convert to 'char' as opposed to 'unsigned
char' for now, as we work through the compiler issues (being careful to
look at comparisons/etc. to make sure it's actually correct) and look at
UTF-8 handling post-Bongo 1.0?

Cheers

Alex.

Loading...