Subject: char is unsigned... wow
To: 'port-macppc@netbsd.org' <port-macppc@netbsd.org>
From: Cliff Neighbors <cliff@allegronetworks.com>
List: port-macppc
Date: 07/31/2000 18:21:09
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFFB56.C5930890
Content-Type: text/plain;
	charset="iso-8859-1"

being new to PPC I must admit that I was slightly astonished
to see that by default the C data type "char" is equivalent to "unsigned
char".

this is not only true for the gcc "specs" in netbsd-macppc, but
moreover the "-fsigned-char" flag appears not to be used in the
kernel builds.

well.  that must have made porting somewhat annoying?
OK for your trouble you avoid one (sign extension) instruction
when you operate on a char.

but "short" is equivalent to "signed short" -- by default you do 
sign extension when e.g. adding two shorts.  so aside from "char"
being, uh "interesting", the handling of char vs. short is inconsistant.

I'm not meaning to bitch here, but I would like to understand the
rationale if anyone who knows the history would care to comment. 

cheers,

	-cliff-


---
cliff neighbors
allegro networks, inc.
cliff@allegronetworks.com
408-281-5532
---



------_=_NextPart_001_01BFFB56.C5930890
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2652.35">
<TITLE>char is unsigned... wow</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>being new to PPC I must admit that I was slightly astonished</FONT>
<BR><FONT SIZE=2>to see that by default the C data type &quot;char&quot; is equivalent to &quot;unsigned char&quot;.</FONT>
</P>

<P><FONT SIZE=2>this is not only true for the gcc &quot;specs&quot; in netbsd-macppc, but</FONT>
<BR><FONT SIZE=2>moreover the &quot;-fsigned-char&quot; flag appears not to be used in the</FONT>
<BR><FONT SIZE=2>kernel builds.</FONT>
</P>

<P><FONT SIZE=2>well.&nbsp; that must have made porting somewhat annoying?</FONT>
<BR><FONT SIZE=2>OK for your trouble you avoid one (sign extension) instruction</FONT>
<BR><FONT SIZE=2>when you operate on a char.</FONT>
</P>

<P><FONT SIZE=2>but &quot;short&quot; is equivalent to &quot;signed short&quot; -- by default you do </FONT>
<BR><FONT SIZE=2>sign extension when e.g. adding two shorts.&nbsp; so aside from &quot;char&quot;</FONT>
<BR><FONT SIZE=2>being, uh &quot;interesting&quot;, the handling of char vs. short is inconsistant.</FONT>
</P>

<P><FONT SIZE=2>I'm not meaning to bitch here, but I would like to understand the</FONT>
<BR><FONT SIZE=2>rationale if anyone who knows the history would care to comment. </FONT>
</P>

<P><FONT SIZE=2>cheers,</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>-cliff-</FONT>
</P>
<BR>

<P><FONT SIZE=2>---</FONT>
<BR><FONT SIZE=2>cliff neighbors</FONT>
<BR><FONT SIZE=2>allegro networks, inc.</FONT>
<BR><FONT SIZE=2>cliff@allegronetworks.com</FONT>
<BR><FONT SIZE=2>408-281-5532</FONT>
<BR><FONT SIZE=2>---</FONT>
</P>
<BR>

</BODY>
</HTML>
------_=_NextPart_001_01BFFB56.C5930890--