This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wimplicit-signed-char
- To: Jamie Lokier <jamie dot lokier at cern dot ch>
- Subject: Re: -Wimplicit-signed-char
- From: Andreas Schwab <schwab at suse dot de>
- Date: Wed, 10 May 2000 16:46:05 +0200
- Cc: Russell King <rmk at arm dot linux dot org dot uk>, gcc at gcc dot gnu dot org,philb at gnu dot org
- References: <200004242320.AAA08131@raistlin.arm.linux.org.uk> <20000425215002.G32745@pcep-jamie.cern.ch>
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