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


Groups > comp.programming > #2507

Re: little-endian

From BGB <cr88192@hotmail.com>
Newsgroups comp.programming
Subject Re: little-endian
Date 2012-11-18 12:50 -0600
Organization albasani.net
Message-ID <k8bar5$pch$1@news.albasani.net> (permalink)
References (9 earlier) <k892t5$p77$1@news.albasani.net> <agquqgF2uveU2@mid.individual.net> <1d8xuw93lwnxy.14j0ojrkbbe4e$.dlg@40tude.net> <k8a8fd$epd$1@news.albasani.net> <1aryj4mzb1le5.13ylu8880ehrj$.dlg@40tude.net>

Show all headers | View raw


On 11/18/2012 3:29 AM, Dmitry A. Kazakov wrote:
> On Sun, 18 Nov 2012 03:03:52 -0600, BGB wrote:
>
>> or when dealing with file-formats.
>
> Provided the file as a transport is well-defined, which is not necessarily
> the case. It depends on the operating system, some have record-oriented
> files some do translation (most notably LF/CR stuff) etc. When the file is
> read using a stream interface (e.g. fgetc), there is a whole pile of I/O
> layers beneath that with their encoding and recoding skeletons in the
> cupboard.
>

typically, I do most IO in binary mode.

the usual notion of a file is that it is a "bag of bytes".


>> other times (depending on how the format is used), it may make sense to
>> use structs, but simply define all of the members as byte-arrays, and
>> then use functions to read/write the values from the structures (this
>> makes things like type-alignment largely a non-issue).
>
> I dropped using that pattern long ago. It is too complicated to maintain
> and to keep portable with little or no performance advantages.
>

IMO, it works ok for times where a person wants to essentially 
memory-map a large structure without having to decode the whole thing in 
the process (it may be decoded incrementally).

this is in contrast to linearly reading/writing values, which is better 
for data which is encoded/decoded linearly, rather than incrementally or 
random-access.


usually, this means parts of things like "image-files" and similar, many 
of these formats also incorporating data compression (sometimes, it is 
data that may be only MB on disk, but when unpacked may take up around 
500MB-1GB or more of RAM).

so, one may end up with data which gets compressed and decompressed 
dynamically.

usually those byte-based structures may end up being things like 
index-tables or directory-tables, which refer to the actual data (which 
may be compressed).


or such...

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


Thread

little-endian bob <bob@coolfone.comze.com> - 2012-11-15 13:45 -0800
  Re: little-endian JJ <jaejunks@glegooilma-swapit.com> - 2012-11-15 23:33 +0000
  Re: little-endian bob <bob@coolfone.comze.com> - 2012-11-16 10:38 -0800
    Re: little-endian "Pascal J. Bourguignon" <pjb@informatimago.com> - 2012-11-16 23:32 +0100
      Re: little-endian BGB <cr88192@hotmail.com> - 2012-11-16 21:17 -0600
        Re: little-endian "Pascal J. Bourguignon" <pjb@informatimago.com> - 2012-11-17 10:26 +0100
          Re: little-endian "BartC" <bc@freeuk.com> - 2012-11-17 11:38 +0000
            Re: little-endian "Pascal J. Bourguignon" <pjb@informatimago.com> - 2012-11-17 13:56 +0100
              Re: little-endian BGB <cr88192@hotmail.com> - 2012-11-17 11:58 -0600
            Re: little-endian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-11-17 19:35 +0000
              Re: little-endian "BartC" <bc@freeuk.com> - 2012-11-17 19:50 +0000
          Re: little-endian BGB <cr88192@hotmail.com> - 2012-11-17 11:30 -0600
            Re: little-endian Ian Collins <ian-news@hotmail.com> - 2012-11-18 09:28 +1300
              Re: little-endian Robert Wessel <robertwessel2@yahoo.com> - 2012-11-17 14:48 -0600
                Re: little-endian BGB <cr88192@hotmail.com> - 2012-11-17 16:22 -0600
                Re: little-endian Ian Collins <ian-news@hotmail.com> - 2012-11-18 15:17 +1300
                Re: little-endian "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-11-18 09:13 +0100
                Re: little-endian Ian Collins <ian-news@hotmail.com> - 2012-11-18 21:33 +1300
                Re: little-endian "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-11-18 10:15 +0100
                Re: little-endian BGB <cr88192@hotmail.com> - 2012-11-18 03:03 -0600
                Re: little-endian "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-11-18 10:29 +0100
                Re: little-endian BGB <cr88192@hotmail.com> - 2012-11-18 12:50 -0600
  Re: little-endian Robin Vowels <robin.vowels@gmail.com> - 2012-11-22 04:49 -0800
    Re: little-endian Jongware <jongware@no-spam.plz> - 2012-11-23 15:22 +0100
      Re: little-endian pacman@kosh.dhis.org (Alan Curry) - 2012-11-25 19:39 +0000
        Re: little-endian Jongware <jongware@no-spam.plz> - 2012-11-26 12:01 +0100
          Re: little-endian "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-11-26 14:02 +0100
            Re: little-endian Jongware <jongware@no-spam.plz> - 2012-11-26 15:34 +0100
              Re: little-endian "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-11-26 17:03 +0100
              Re: little-endian Robert Wessel <robertwessel2@yahoo.com> - 2012-11-26 17:44 -0600
                Re: little-endian Robin Vowels <robin.vowels@gmail.com> - 2012-11-28 23:43 -0800
                Re: little-endian Robert Wessel <robertwessel2@yahoo.com> - 2012-11-29 22:46 -0600
          Re: little-endian BGB <cr88192@hotmail.com> - 2012-11-26 08:30 -0600
        Re: little-endian Robin Vowels <robin.vowels@gmail.com> - 2012-11-28 23:45 -0800

csiph-web