Mail Archives: djgpp/2000/01/24/07:33:41
Thanks to everyone who responded to original message.
On Fri, 21 Jan 2000, Andris Pavenis and Shawn Hargreaves wrote:
: use -funsigned-char
The compiler switch "-funsigned-char" does not really helped as character
constants like 'A' or arrays like "Hi" are implicitly signed. I must have
overtyped most of these instances in this case.
On Fri, 21 Jan 2000, Damian Yerrick wrote:
:typedef unsigned char byte;
:and use byte instead of char.
:const byte tilde = '~';
Surprisingly this code works, but works only for single constants not for
arrays, so
const byte *hi = "Hi";
won't work without overtyping.
On Fri, 21 Jan 2000, Hans-Bernhard Broeker wrote:
: Bad coding in that project, then. If they had to have unsigned chars,
: they should have *coded* unsigned chars, not rely on some compiler
: switch to automagically do it for them...
True and I must admit, that I have just rewritten the code to distinguish
between signed or unsigned char although we need only the unsigned type of
the char.
The problem is solved, but is not as neat as I would expect, because I still
have to mix signed and unsigned types when I use libc functions like printf,
sprintf in the case, that the unsigned type is readable text and need to be
printed or when the buffers may use both text and binary (unsigned)
information.
- Raw text -