gnustep-dev
[Top][All Lists]
Advanced

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

Re: char vs. unsigned char


From: Stefan Bidigaray
Subject: Re: char vs. unsigned char
Date: Fri, 13 Mar 2015 08:33:18 -0400

That's also true for ARM. On my Cubietruck I had explicitly specify unsigned and signed for all typedef types in CoreBase.

As was already mentioned, I think it should be thought as:
char = characters
Unsigned char = unsigned integer less 256 or data
Signed char = signed integer between -128 to 127

I'll also add in CF and, by extension, CoreBase does it. Raw data is always unsigned char, but characters are simply char. See CFStringCreateWithBytes vs CFStringCreateWithCString.

On Mar 13, 2015 8:24 AM, "Sebastian Reitenbach" <address@hidden> wrote:


Am 3/12/2015 um 8:11 PM schrieb Riccardo Mottola:
Hi,

a developer question. I got LuserNET working again! another application almost saved from bitrot :)

I get however a lot of warnings about signedess in char*. In several palces data buffers are specified as unsigned char, while in other places data coming from those buffers is used as char*, including when passing to C functions like atoi().

My simple knowledge would say that usually one can just use char* when treating the content as binary or as string. While signeddess matters when numbers are stored.

I converted many buffers and structs. Everything continues to work as far as I can see.

Could someone comment? check my patch at least by skimming over it?

I wonder why these were declared as unsigned as first.

Maybe it's just to be explicit. I.e. PPC is different thant most (all) other platforms with regard what is the default for char *.
I.e. "char *" means "unsigned char" on PPC, where it means "signed char" on everywhere else,
or vice versa, I always tend to mix that up ;)
Being explicit about the signed with regard to char, at least where it matters, makes things work on PPC and others.

Sebastian

Riccardo



_______________________________________________
Gnustep-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/gnustep-dev


_______________________________________________
Gnustep-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/gnustep-dev


reply via email to

[Prev in Thread] Current Thread [Next in Thread]