[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to fix wrong char signedness



Hi.

I maintain widestudio(Multi platform C++ IDE for x11) and recently I
received a bug report(Bug#170530).  The report said that char is
unsigned on arm, powerpc and s390, and source codes such as

  while( val[end] != 0 && val[end] != -1 ){

lead to g++ warnings as follows;
  
  WSdrDef.cpp:112: warning: comparison is always true due to limited 
  range of data type

and might cause a runtime error.

I was asked by upstream author whether it is correct or not to change
source codes such as

  char val;
  val = -1;

to

  signed char val;
  val = -1;

Could anyone tell me this?

--
 Hidetaka Iwai
 tyuyu@sings.jp



Reply to: