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


Groups > comp.lang.c > #123541

Re: Recasting data as long ints and chars

From "Pascal J. Bourguignon" <pjb@informatimago.com>
Newsgroups comp.lang.c
Subject Re: Recasting data as long ints and chars
Date 2017-11-27 23:49 +0100
Organization Informatimago
Message-ID <m27eubcp68.fsf@informatimago.com> (permalink)
References (2 earlier) <oveo59$aa0$1@dont-email.me> <87fu90mw6q.fsf@bsb.me.uk> <g2V32ppLhPDKcENafQyUTwdjN1mwQ@bongo-ra.co> <m2efokcelh.fsf@informatimago.com> <4c779337-fbfa-6fd9-c727-834e074ee673@verizon.net>

Show all headers | View raw


"James R. Kuyper" <jameskuyper@verizon.net> writes:

> Note that not only does the standard not constrain the byte ordering
> in any way, it also does not constrain the bit ordering, either. I
> can't imagine any reason why anyone would do so, but it wouldn't
> violate any requirement imposed by the C standard to, for instance,
> store each of the four lowest-order bits in a different byte of a
> four-byte integer.

The notion of thing-ordering has a sense only if there's is a way to
_address_ things.

You cannot have bit-ordering if you can't have a pointer to a bit.

In the case of the C programming language, pointers may address at most
char (sizeof(char)=1).  Therefore the notion of bit ordering is
meaningless in C.

It is also meaningless in hardware, in the sense that bits are not
ordered logically (by an increasing address), but physically,
spacio-temporally.  You can have some bits laid out on the right or on
the left, perhaps in front or behind, or even above or below other bits,
some bits may be transmitted before or after some other bits when
serialized.  And this changes from chip to chip, from bus to bus.  It
doesn't matter, as long as the hardware is consistent (you read back the
same bit you wrote, in the same order, when you read or write a byte).

-- 
__Pascal J. Bourguignon
http://www.informatimago.com

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Recasting data as long ints and chars James Harris <james.harris.1@gmail.com> - 2017-11-19 21:11 +0000
  Re: Recasting data as long ints and chars Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-23 00:50 +0000
    Re: Recasting data as long ints and chars James Harris <james.harris.1@gmail.com> - 2017-11-26 15:55 +0000
      Re: Recasting data as long ints and chars Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-26 23:55 +0000
        Re: Recasting data as long ints and chars Spiros Bousbouras <spibou@gmail.com> - 2017-11-27 06:43 +0000
          Re: Recasting data as long ints and chars "Pascal J. Bourguignon" <pjb@informatimago.com> - 2017-11-27 09:26 +0100
            Re: Recasting data as long ints and chars Spiros Bousbouras <spibou@gmail.com> - 2017-11-27 08:50 +0000
            Re: Recasting data as long ints and chars "James R. Kuyper" <jameskuyper@verizon.net> - 2017-11-27 10:35 -0500
              Re: Recasting data as long ints and chars supercat@casperkitty.com - 2017-11-27 08:00 -0800
              Re: Recasting data as long ints and chars "Pascal J. Bourguignon" <pjb@informatimago.com> - 2017-11-27 23:49 +0100
                Re: Recasting data as long ints and chars jameskuyper@verizon.net - 2017-11-27 15:56 -0800
            Re: Recasting data as long ints and chars herrmannsfeldt@gmail.com - 2017-12-15 12:45 -0800
          Re: Recasting data as long ints and chars Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-27 15:08 +0000
        Re: Recasting data as long ints and chars James Harris <james.harris.1@gmail.com> - 2017-11-27 14:55 +0000
          Re: Recasting data as long ints and chars Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-27 15:51 +0000
            Re: Recasting data as long ints and chars James Harris <james.harris.1@gmail.com> - 2017-11-28 17:13 +0000
              Re: Recasting data as long ints and chars Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-29 01:07 +0000
                Re: Recasting data as long ints and chars Spiros Bousbouras <spibou@gmail.com> - 2017-11-29 18:59 +0000
                Re: Recasting data as long ints and chars Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-30 00:53 +0000
                Re: Recasting data as long ints and chars Keith Thompson <kst-u@mib.org> - 2017-11-29 17:01 -0800
                Re: Recasting data as long ints and chars Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-30 11:40 +0000
                Re: Recasting data as long ints and chars James Harris <james.harris.1@gmail.com> - 2017-11-30 19:53 +0000
              Re: Recasting data as long ints and chars Spiros Bousbouras <spibou@gmail.com> - 2017-11-29 18:37 +0000
                Re: Recasting data as long ints and chars James Harris <james.harris.1@gmail.com> - 2017-11-30 22:38 +0000
                Re: Recasting data as long ints and chars Spiros Bousbouras <spibou@gmail.com> - 2017-12-07 05:06 +0000
                Re: Recasting data as long ints and chars supercat@casperkitty.com - 2017-12-07 07:51 -0800
                Re: Recasting data as long ints and chars James Harris <james.harris.1@gmail.com> - 2017-12-08 23:14 +0000
                Re: Recasting data as long ints and chars supercat@casperkitty.com - 2017-12-12 16:19 -0800
                Re: Recasting data as long ints and chars Keith Thompson <kst-u@mib.org> - 2017-12-12 17:10 -0800
                Re: Recasting data as long ints and chars supercat@casperkitty.com - 2017-12-13 09:02 -0800
                Re: Recasting data as long ints and chars herrmannsfeldt@gmail.com - 2017-12-15 12:39 -0800
                Re: Recasting data as long ints and chars Robert Wessel <robertwessel2@yahoo.com> - 2017-12-15 17:39 -0600
                Re: Recasting data as long ints and chars herrmannsfeldt@gmail.com - 2017-12-15 15:52 -0800
                Re: Recasting data as long ints and chars Robert Wessel <robertwessel2@yahoo.com> - 2017-12-16 00:35 -0600
                Re: Recasting data as long ints and chars herrmannsfeldt@gmail.com - 2017-12-17 14:02 -0800
                Re: Recasting data as long ints and chars "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2017-12-17 15:15 -0800
                Re: Recasting data as long ints and chars herrmannsfeldt@gmail.com - 2017-12-17 18:47 -0800
                Re: Recasting data as long ints and chars herrmannsfeldt@gmail.com - 2017-12-17 14:09 -0800
                Re: Recasting data as long ints and chars herrmannsfeldt@gmail.com - 2017-12-17 14:19 -0800
                Re: Recasting data as long ints and chars herrmannsfeldt@gmail.com - 2017-12-17 14:45 -0800
                Re: Recasting data as long ints and chars Spiros Bousbouras <spibou@gmail.com> - 2017-12-13 19:13 +0000
                Re: Recasting data as long ints and chars James Harris <james.harris.1@gmail.com> - 2018-02-10 05:46 +0000

csiph-web