This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -Wimplicit-signed-char


Jamie Lokier <jamie.lokier@cern.ch> writes:

|> Russell King wrote:
|> > 	char ch;
|> > 	do {
|> > 		ch = getopt(...);
|> > 		...
|> > 	} while (ch != EOF);
|> > 
|> > The above fragments of code compile cleanly on architectures which default
|> > to signed chars.
|> 
|> However, the EOF fragment is broken whatever the signedness :-)
|> Use `int ch'.

Moreover, getopt does not actually return EOF, but -1.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]