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 &quot;-fsigned-char&quot; to gcc when you build your library.<br>
<br>&nbsp;- Juha<br><br><div class="gmail_quote">On Sat, Apr 5, 2008 at 9:40 PM, Andrew Daviel &lt;<a href="mailto:advax@triumf.ca">advax@triumf.ca</a>&gt; 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&#39;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>
 &nbsp;warning: comparison is always false due to limited range of data type<br>
 &nbsp;warning: converting of negative value `-0x00000000000000001&#39; to `char&#39;<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 &quot;stdio.h&quot;<br>
int main() {<br>
 &nbsp; int j = -2 ;<br>
 &nbsp; char k ;<br>
 &nbsp; unsigned char m ;<br>
 &nbsp; signed char n ;<br>
 &nbsp; m = j ; n = j ; k = j ;<br>
 &nbsp; if (j &lt; 0) printf (&quot;j &lt; 0\n&quot; ) ;<br>
 &nbsp; if (k &lt; 0) printf (&quot;k &lt; 0\n&quot; ) ;<br>
 &nbsp; if (m &lt; 0) printf (&quot;m &lt; 0\n&quot; ) ;<br>
 &nbsp; if (n &lt; 0) printf (&quot;n &lt; 0\n&quot; ) ;<br>
}<br>
<br>
On my i386 desktop, with gcc 4.0.2 or 3.2.3, k &lt; 0<br>
In scratchbox-ARMEL, with gcc 3.4.4, k &gt; 0<br>
<br>
By which I presume that &quot;char&quot; 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 &nbsp;(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&#39;s toll. Please have exact change.