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


Groups > comp.lang.forth > #57892

Re: Endianness

From "HAA" <someone@microsoft.com>
Newsgroups comp.lang.forth
Subject Re: Endianness
Date 2017-04-23 18:57 +1000
Organization Aioe.org NNTP Server
Message-ID <odhqbu$ejj$1@gioia.aioe.org> (permalink)
References <xn0kp08uz8o02ku009@nntp.aioe.org> <odeamr$17qc$1@gioia.aioe.org><xn0kp0y47953vao00e@nntp.aioe.org> <odh344$1gor$1@gioia.aioe.org> <7fac2666-c7fe-4a7d-a46a-d958556f4418@googlegroups.com>

Show all headers | View raw


Julian Fondren wrote:
> On Saturday, April 22, 2017 at 9:22:04 PM UTC-5, HAA wrote:
> > Rudy Velthuis wrote:
> > > HAA 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.  Worse still if you forget and use C@ because then
> > > > your code is no longer endian portable.
> > >
> > > I'd say it is, because C@ (and C!) deal with (how do they call them?
> > > address units?) bytes, and in every language I know, no matter if it is
> > > on a big- or little-endian platform, bytes are always stored at
> > > consecutive addresses. It only gets hairy if you store a byte with ! or
> > > fetch it with @. But you shouldn't do that anyway, in no language I
> > > know.
> >
> > As far as Forth is concerned a character/byte on the stack *is* an
> > integer and using ! to store is quite legal assuming destination has
> > at least 1 cell of space.
>
> Why are you saying this like it's novel, or like it refutes what it
> replies to? Fetching a cell from an address containing only a char is
> (probably) a type error. In Forth, you manage your types yourself.
> Your errors are still errors. "You shouldn't index out of array
> bounds, in no language I know." also isn't rebutted by "Forth doesn't
> check for that". If you have an off-by-one error in an loop pover
> array contents you can still go on to display garbage to the user,
> etc.

This is what was said:

> > Rudy Velthuis wrote:
> > > ...
> > > It only gets hairy if you store a byte with ! or
> > > fetch it with @. But you shouldn't do that anyway, in no language I
> > > know.

And I was refuting it - politely.


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