Re: RfD: Signed and Unsigned Word Fetch and Store



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/
.



Relevant Pages

  • Re: unix filename restriction
    ... underscore _ and the dot. ... You could use other characters, ... never met a *human* defined path of more than 80 chars (most of the ... If you want to be very sure, limit your filename to the DOS limit of 8 ...
    (comp.os.linux.development.apps)
  • Re: Predefined Cell Character Length
    ... =LEFTreturns up to 10 characters. ... If 3 chars in a cell just those 3 will be returned. ... Gord Dibben MS Excel MVP ... cells in clumn A can only be 10 characters at the most, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: 128 bit password
    ... Joe Richards Microsoft MVP Windows Server Directory Services ... Assumption would be that it would get truncated at 127/128 characters... ... then these are 16 bit chars. ...
    (microsoft.public.security)
  • [4E] Keep on the Shadowfell - pregen chars
    ... Played our first game of 4E at home. ... We used the pre-gen chars. ... To put it bluntly, they hated the characters. ... I got some funny looks when they dropped a kobold minion with 2 points ...
    (rec.games.frp.dnd)
  • Re: RfD: c-addr/len
    ... know that there is no practical value in using CHARS. ... I intend to go for 32-bit characters ... On SP-Forth, there is no command-line editing, only backspace. ... strings without having to know how they break into display characters; ...
    (comp.lang.forth)