Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #57936

Re: Endianness

Subject Re: Endianness
References <xn0kp08uz8o02ku009@nntp.aioe.org> <odeamr$17qc$1@gioia.aioe.org> <SaidnZYcTP1T6mHFnZ2dnUU7-cednZ2d@supernews.com> <odjfpg$1489$1@gioia.aioe.org>
Newsgroups comp.lang.forth
From "Elizabeth D. Rather" <erather@forth.com>
Organization FORTH, Inc.
Date 2017-04-23 14:40 -1000
Message-ID <eqWdnaEIEuf31GDFnZ2dnUU7-RPNnZ2d@supernews.com> (permalink)

Show all headers | View raw


On 4/23/17 2:09 PM, HAA wrote:
> Andrew Haley wrote:
>> HAA <someone@microsoft.com> wrote:
>>> Rudy Velthuis wrote:
>>>> ...
>>>> If this is the case, is this true for bytes in a cell too, or is that
>>>> implementation defined?
>>>
>>> This is where things can get messy.  Let's say you need to store a
>>> character in a variable.  Usual practice is to use VARIABLE for this
>>> because there's nothing conveniently smaller.  This leads to use
>>> of @ ! in Forth code to handle characters which is an obvious type
>>> mismatch.
>>
>> This doesn't really make any sense to me.  You can always access
>> individual bytes of storage, so creating a VARIABLE and accessing it
>> with C@ and C! is just fine.
>
> It is fine.  But when a programmer unfamiliar with the code notes
> storage labelled VARIABLE, he may well conclude @ and ! was
> appropriate and mistakenly apply it.  Endianness may bring forth
> the error, or hide it.  Finding the bug could prove interesting.

So long as you consistently use *either* c@/c! *or* @/! you're fine. You 
only get in trouble if you've done a ! and then do a c@ and wonder what 
you've got.

Cheers,
Elizabeth

-- 
Elizabeth D. Rather
FORTH, Inc.
6080 Center Drive, Suite 600
Los Angeles, CA  90045
USA

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Endianness "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-04-21 20:46 +0000
  Re: Endianness Alex <alex@rivadpm.com> - 2017-04-21 22:48 +0100
    Re: Endianness "Elizabeth D. Rather" <erather@forth.com> - 2017-04-21 12:16 -1000
      Re: Endianness "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-04-22 04:42 +0000
        Re: Endianness "Elizabeth D. Rather" <erather@forth.com> - 2017-04-21 21:45 -1000
  Re: Endianness "HAA" <someone@microsoft.com> - 2017-04-22 11:12 +1000
    Re: Endianness "Elizabeth D. Rather" <erather@forth.com> - 2017-04-21 16:11 -1000
      Re: Endianness hughaguilar96@gmail.com - 2017-04-23 13:41 -0700
      Re: Endianness Bernd Paysan <bernd@net2o.de> - 2017-05-07 22:52 +0000
    Re: Endianness "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-04-22 04:45 +0000
      Re: Endianness "HAA" <someone@microsoft.com> - 2017-04-23 12:21 +1000
        Re: Endianness Julian Fondren <julian.fondren@gmail.com> - 2017-04-22 22:49 -0700
          Re: Endianness "HAA" <someone@microsoft.com> - 2017-04-23 18:57 +1000
            Re: Endianness Julian Fondren <julian.fondren@gmail.com> - 2017-04-23 02:13 -0700
          Re: Endianness "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-04-29 03:37 +0000
      Re: Endianness anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-24 16:56 +0000
    Re: Endianness Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-04-23 04:45 -0500
      Re: Endianness "HAA" <someone@microsoft.com> - 2017-04-24 10:09 +1000
        Re: Endianness "Elizabeth D. Rather" <erather@forth.com> - 2017-04-23 14:40 -1000
          Re: Endianness "HAA" <someone@microsoft.com> - 2017-04-24 13:41 +1000
            Re: Endianness "Elizabeth D. Rather" <erather@forth.com> - 2017-04-23 17:58 -1000
              Re: Endianness hughaguilar96@gmail.com - 2017-04-23 21:42 -0700
                Re: Endianness Julian Fondren <julian.fondren@gmail.com> - 2017-04-23 21:58 -0700
            Re: Endianness Julian Fondren <julian.fondren@gmail.com> - 2017-04-23 21:18 -0700
              Re: Endianness Julian Fondren <julian.fondren@gmail.com> - 2017-04-23 21:24 -0700
              Re: Endianness "HAA" <someone@microsoft.com> - 2017-04-26 09:21 +1000
                Re: Endianness Julian Fondren <julian.fondren@gmail.com> - 2017-04-25 16:56 -0700
  Re: Endianness anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-24 16:58 +0000

csiph-web