[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Re: Bug#169450: wrong assumption on char signedness



"H. S. Teoh" <hsteoh@quickfur.yi.org> writes:

> On Mon, Nov 18, 2002 at 09:13:05PM +0100, Emile van Bergen wrote:
> > Hi,
> > 
> > On Mon, Nov 18, 2002 at 01:08:02PM -0500, H. S. Teoh wrote:
> > 
> > > Hmm, I looked at the source code, and it seems that one of the arguments
> > > being compared is a gchar (probably a char defined by GTK libs). Smurf
> > > itself doesn't specify whether the variable is signed or not. Anybody
> > > knows how gchar is supposed to behave? Should it be signed or unsigned? 
> > 
from glib/gtypes.h:

------<snip>--------
typedef char   gchar;

typedef unsigned char   guchar;
------<snap>--------

So gchar is supposed to behave exactly like char.

> > <rant>
> > When I see stuff like that, I can't help but wonder why the h*ll a GUI
> > library needs to mess around with the basic C types. I cannot think of
> [snip]
> 
I think they just did it for consistency: it makes sense to have
guchar (since "unsigned char" is a bit long, at least if you're a lazy
typer ;-)), so for completeness and consistency they also define
gchar, /methinks.

Regards, Andy
-- 
Andreas Rottmann         | Dru@ICQ        | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62



Reply to: