GCC 4 and signedness

Lee Braiden lee_b at digitalunleashed.com
Thu Sep 1 09:05:35 UTC 2005


On Thursday 01 September 2005 04:44, Dave Walker wrote:
> I just updated breezy today, and noticed that GCC4 was being installed.
> Since it has been installed almost all the projects I have been working
> on, are getting at least 10
>
> "pointer targets in passing argument 1 of
> ‘gaim_uri_list_extract_filenames’ differ in signedness"
>
> or similar. My question is why is it complaining that, in an example of
> strcmp, I am comparing unsigned char* with a char*? The point is I don't
> care the sign, all I care about is if they are the same. Or am I missing
> a very simple thing about signedness?

This used of values like -1 in a char value is a bug.  It happens to work on 
some architectures, but it's just plain wrong on others.  Usually, it happens 
when people use a char to whole the return value of getc() and functions like 
that, and then then compare it to -1 to see if something went wrong.  getc() 
returns an int, though.

You should really fix the code.  But if it's not your code, it's full of 
mistakes, and you just want the damned thing to compile ;)... then there are 
command line arguments you can give to the compiler that will ignore the 
errors or work around them (for now).  I *really* wouldn't recommend 
developing your own code by relying on the compiler to fix your mistakes 
though; chances are the next major version of gcc will simply refuse to 
compile it, no matter what you do.

-- 
Lee Braiden
http://www.DigitalUnleashed.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050901/c7f085d9/attachment.sig>


More information about the ubuntu-users mailing list