Hi Russell, Phil,

I figured out why the termios program did not work on the Brutus. It was
not related to termios stuff, rather how chars might not be the same on
the PC as on the brutus.

In this code there is a function (int foo())that returns an int. But the
return value is assigned to a char:

char c;
c = foo();

if (c >= 0) 

The arm-linux-gcc (egcs-1.1.1 with your patch + glibc-2.1) warns me that
this will always be true, due to limited range of the variable. The
native PC compiler (gcc-2.7.2.3, glibc 2.0.7) does not complain. The PC
version works flawlessly, the arm version probably assigns 0 to c.

Later in the code:

if (c < 0)

Same warning (will never be true) with the arm gcc, no warning with the
native gcc.

Workaround:

int temp_c;

temp_c = foo();

c = (char)temp_c; //so I can compare it as a char

if (c >= 0)
.
.
.
if (temp_c < 0) // because c apperantly does not go < 0


So, I guess the gcc-2.7.2.3 does automatic typecasting, the cross-egcs
does not ? And the native char seems to be signed, while the cross-char
unsigned ? I wonder what the ANSI C docs say about this.

Anyway, I thought you might like to know about this. Maybe gcc-2.7 is
out of spec, I don't know.

The code is the robin.c program from Erik Troan's Linux Applications
Development book, and the first warning was line 193, the second at line
220.

After the above modifications the code compiles without errors or
warnings, and runs on the Brutus (yeee!!!!!!!). Also on the PC.

Later,

Zsolt
[EMAIL PROTECTED]
unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]

Reply via email to