Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Bernd Paysan <bernd.paysan@xxxxxx>
- Date: Tue, 25 May 2010 16:51:17 +0200
Anton Ertl wrote:
So even though in C char can be seen as integer type (just as a char
in Forth can be seen as an integer type), the main job of chars in C
(and even more so in Forth) is to represent characters, and that's why
there is a difference in the treatment of signedness between the int
types and char in C. And the behaviour of C@ in Forth does not set a
precedent for W@ and L@, either, because C@ is for characters and W@
and L@ are for integers.
That's your assertion, and I still wonder why you do think so? How do you
know what W@ and L@ are for? They are defined for 16 and 32 bit data in
memory. W@ may be used for UCS-2 characters, L@ for 32 bit bit masks or
IPv4 internet addresses (in the L@BE form), the main purpose to use these
words is to interface with hardware, C libraries and external file formats.
You don't know if they are integers, if there is a particular order or
whether sign matters. At least you admit that the more frequently used case
should be the shorter one.
C@ is used for chars and bytes, even though the intention obviously is to
stand for chars only. But most embedded Forth code uses C@ for arbitrary
bytes, not just characters.
--
Bernd Paysan
"If you want it done right, you have to do it yourself!"
http://www.jwdt.com/~paysan/
.
- Follow-Ups:
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Anton Ertl
- Re: RfD: Signed and Unsigned Word Fetch and Store
- References:
- RfD: Signed and Unsigned Word Fetch and Store
- From: Krishna Myneni
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Anton Ertl
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Andrew Haley
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Krishna Myneni
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Andrew Haley
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Krishna Myneni
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Bernd Paysan
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Anton Ertl
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Bernd Paysan
- Re: RfD: Signed and Unsigned Word Fetch and Store
- From: Anton Ertl
- RfD: Signed and Unsigned Word Fetch and Store
- Prev by Date: Re: The Art and Science of Factoring
- Next by Date: Re: The Art and Science of Factoring
- Previous by thread: Re: RfD: Signed and Unsigned Word Fetch and Store
- Next by thread: Re: RfD: Signed and Unsigned Word Fetch and Store
- Index(es):
Relevant Pages
|