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


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'.

have a nice day,
-- Jamie

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