Signedness of char and puts()

Ed Stafford ed.stafford@xilinx.com
Fri Mar 28 20:04:00 GMT 2008


The following code produces 2 warnings with gcc 4.1.1:

signed char * mystring = "Hello";                       
puts (mystring);

warning: pointer targets in initialization differ in signedness
warning: pointer targets in passing argument 1 of 'puts' differ in signedness

Modifying the code as shown below corrects the problem:

char * mystring = "Hello";

The same warnings occur is the char is declared unsigned.

Does anyone know why this occurs?  

Thank you.            

 




More information about the Gcc-help mailing list