Wireshark-dev: Re: [Wireshark-dev] FYI: Status of gcc warnings in epan/dissectors

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 28 Mar 2007 09:43:50 -0700
Stephen Fisher wrote:

Well, since (g)char defaults to unsigned on most platforms,

No, it doesn't.  "char" defaults to *signed* on most platforms, because

1) the PDP-11's "movb" instruction sign-extended, so "char" was made signed on the PDP-11

and

2) the VAX C implementation did the same, to make as much code continue to work without change

and

	3) almost everybody else did the same for PDP-11 or VAX compatibility.

I think there were a few with unsigned "char" - I think the C for the UNIX on the Gould (SEL) 32-bit superminis was one - but they were rare.

The problem is that we use guint8 all over the place, but the standard C and GLib functions use char.

"guint8" is appropriate for an octet whose contents might, or might not, be text.

"char" is appropriate for C strings (it's unfortunate that it wasn't unsigned by default, to avoid ugly sign-extension in, for example, the is*() macros, with something such as "{unsigned} short short int" for 8-bit integral data types, but I digress...).