Char is indeed unsigned on ARM by default. <br><br><a href="http://www.arm.linux.org.uk/docs/faqs/signedchar.php">http://www.arm.linux.org.uk/docs/faqs/signedchar.php</a><br><br>You could try to give "-fsigned-char" to gcc when you build your library.<br>
<br> - Juha<br><br><div class="gmail_quote">On Sat, Apr 5, 2008 at 9:40 PM, Andrew Daviel <<a href="mailto:advax@triumf.ca">advax@triumf.ca</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
I have been trying to compile the opencv library for my N810 using<br>
scratchbox. My application is OK on x86 and compiles but doesn't work on<br>
ARM, and I find<br>
some of the library functions returning different results with supposedly<br>
identical data. Going back over the library build I find some compiler<br>
warnings such as<br>
warning: comparison is always false due to limited range of data type<br>
warning: converting of negative value `-0x00000000000000001' to `char'<br>
<br>
After some time tracing back data include files and defines I find<br>
that some modules in the library are doing arithmetic with char, and the<br>
compiler spots e.g. static comparisons.<br>
<br>
The following snippet shows the problem:<br>
<br>
#include "stdio.h"<br>
int main() {<br>
int j = -2 ;<br>
char k ;<br>
unsigned char m ;<br>
signed char n ;<br>
m = j ; n = j ; k = j ;<br>
if (j < 0) printf ("j < 0\n" ) ;<br>
if (k < 0) printf ("k < 0\n" ) ;<br>
if (m < 0) printf ("m < 0\n" ) ;<br>
if (n < 0) printf ("n < 0\n" ) ;<br>
}<br>
<br>
On my i386 desktop, with gcc 4.0.2 or 3.2.3, k < 0<br>
In scratchbox-ARMEL, with gcc 3.4.4, k > 0<br>
<br>
By which I presume that "char" is signed on the 386 and unsigned on the<br>
ARM.<br>
<br>
Is there any way I can override the compiler default, or do I have to go<br>
through everything by hand and see where char is used inappropriately ?<br>
<br>
How general is this, that data types are different on different systems<br>
(I know about the int/long issues on 64-bit machines ...) ?<br>
<font color="#888888"><br>
<br>
--<br>
Andrew Daviel, TRIUMF, Canada<br>
Tel. +1 (604) 222-7376 (Pacific Time)<br>
Network Security Manager<br>
_______________________________________________<br>
maemo-developers mailing list<br>
<a href="mailto:maemo-developers@maemo.org">maemo-developers@maemo.org</a><br>
<a href="https://lists.maemo.org/mailman/listinfo/maemo-developers" target="_blank">https://lists.maemo.org/mailman/listinfo/maemo-developers</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Madness takes it's toll. Please have exact change.