public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Signedness of char and puts()
@ 2008-03-28 20:04 Ed Stafford
  2008-03-28 23:25 ` Eljay Love-Jensen
  0 siblings, 1 reply; 12+ messages in thread
From: Ed Stafford @ 2008-03-28 20:04 UTC (permalink / raw)
  To: gcc-help

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.            

 


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-04-17 10:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-28 20:04 Signedness of char and puts() Ed Stafford
2008-03-28 23:25 ` Eljay Love-Jensen
2008-03-29  1:04   ` me22
2008-03-29  1:19   ` Matthew Woehlke
2008-03-29 12:43     ` Eljay Love-Jensen
2008-03-31  9:15   ` Michael Eager
2008-03-31 11:44     ` John Love-Jensen
2008-03-31 14:56       ` Michael Eager
2008-03-31 15:06         ` Ed Stafford
2008-03-31 17:28           ` Michael Eager
2008-04-17  9:38   ` lynx.abraxas
2008-04-17 13:49     ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).