RE: Pointer signedness
RE: Pointer signedness
- Subject: RE: Pointer signedness
- From: "Dallman, John" <email@hidden>
- Date: Wed, 22 Jan 2014 15:32:26 +0000
- Thread-topic: Pointer signedness
Ken Thomases wrote:
> On Jan 22, 2014, at 7:00 AM, Jan E. Schotsman wrote:
> > I am getting an error "pointer targets differ in signedness"
> > in some code. The pointer is a stack array myArray. If I
> > change the array declaration from
> >
> > SInt8 myArray[64] to char myArray[64]
> >
> > the error goes away. This must be a bug in Xcode 3.1.3, right?
>
> I don't think so. Whether char is signed or unsigned depends on
> the compiler and its options. Code which makes the (possibly
> implicit) assumption that it's one or the other is not portable.
> It can break when compiled differently. Therefore the warning.
Absolutely. Since SInt8 is a signed type, and switching to char makes
a difference, char is presumably unsigned in your compiles.
The error sounds as if you're assigning to or from myArray from a
char, or other unsigned type. So you need to look at the variables
that are involved with myArray and see what type those are.
There's also the question of "what is the meaning of the data you're
handing?" Is it very small integers, binary bytes, 8-bit characters,
or something else? That's something you need to consider when deciding
what to change.
--
John Dallman
-----------------
Siemens Industry Software Limited is a limited company registered in England and Wales.
Registered number: 3476850.
Registered office: Faraday House, Sir William Siemens Square, Frimley, Surrey, GU16 8QD.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden