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


Groups > comp.lang.c > #55195

Re: formats and endians

From Kleuske <kleuske@nowhere.net>
Newsgroups comp.lang.c
Subject Re: formats and endians
Date 2014-12-21 14:17 +0000
Organization A noiseless patient Spider
Message-ID <m76kpv$9lt$2@dont-email.me> (permalink)
References (2 earlier) <7574c31e-e608-4574-ab59-2043ef2fe835@googlegroups.com> <m6pdkp$asd$1@dont-email.me> <m6prbf$tcm$1@dont-email.me> <m6rodn$h70$3@dont-email.me> <m6vkcv$m43$1@dont-email.me>

Show all headers | View raw


On Thu, 18 Dec 2014 16:28:01 -0600, Stephen Sprunk saw fit to publish the
following:

> On 17-Dec-14 05:11, Kleuske wrote:
>> Stephen Sprunk saw fit to publish the following:
>>> On 16-Dec-14 07:55, Kleuske wrote:
>>>> One way of doing that is using a "magic number" at the start of the
>>>> file. That way, either method can be used to write the format and the
>>>> reader knows whether or not to translate.
>>> 
>>> That's actually worse because now every reader of the format has to
>>> have code to deal with both cases--and Murphy's Law says that the data
>>> will always be of the non-native form, slowing access down for
>>> everyone.
>> 
>> Invoking Murphy's law to support a point about (basically) statistics
>> is not a very good argument.
> 
> Then you're missing real-life experience with Murphy's Law.

I have sufficient experience with that law to know it's recursive. If you 
count on it, it works and therefore it doesn't.

Apart from the obvious sniping, is that intended as an actual argument? 
If so, you'll have to do better.

>> In my experience, files tend to get read on pretty much the same
>> platform that wrote the file, since most companies have (relatively)
>> uniform IT equipment. No conversion required.
> 
> Well, if you're going to go that way, then it bears pointing out that
> _most_ files are only read by the _system_ that wrote them.

True. But that's a mere specialisation of what I said in the first place.

> Still, many companies have (or at least had) lots of BE machines in
> their datacenters, whereas the desktop is now mostly LE.
> 
> Were PPC (and m68k) Macs BE or LE?

BE. I used to do a lot of conversions writing software for the Mac.

>> In a usermarket, the same goes, since most user-equipment runs on
>> (small endian) Intel chips, though (big *and* little endian) ARM-chips
>> are on the increase (smart phones). Usually no conversions required.
> 
> Tons of conversions are required because the vast majority of wire and
> file formats are BE.

True. The famed "network byte order". See RFC 1700.

>  In fact, the resurgence of BE devices is now
> _lowering_ the number of conversions.

Yes. And how exactly is that an argument instead of an observation? 


>> Since reading (and recoding if needed) happens only once, the price to
>> pay isn't very big, certainly not in comparison to decoding the entire
>> file into a bitmap.
> 
> All of the parsing combined is generally noise compared to the I/O
> necessary to get the file in the first place.  What really matters is
> programmer time, which is largely driven by complexity--and
> variable-endian is inherently more complex than either fixed-endian.

If there's a simple, reliable API to handle that transparantly (Lo and 
Behold! Someone already thought of that!), there's no real difference. 
You can use it to handle Middle Endian, too! And by a measure of 
complexity, you have different things to worry about that LE/BE. 
Supporting multiple versions, for one. 

>> The risk of someone screwing up the conversion is rather limited since
>> there *are* reliable library functions to handle it quite efficiently.
> 
> Functions to convert BE data are widely availability because they're
> included with Berkeley sockets, and will be heavily optimized due to use
> by TCP/IP stacks; I'm not aware of anything similar for LE data.

Well... That's what I said. On systems without a network-stack, there are 
other libs doing exactly the same and if push really comes to shove, it's 
not that hard to roll your own (last resort, mind you).

FYI, I was merely suggesting ONE way of doing it. There are others. 
Simply specify BE/LE (whatever) in your design documents, for instance 
and let developers worry about it.

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


Thread

formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 04:49 -0800
  formats and endians John Bode <jfbode1029@gmail.com> - 2014-12-16 05:24 -0800
    Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 05:38 -0800
      Re: formats and endians Kleuske <kleuske@nowhere.net> - 2014-12-16 13:55 +0000
        Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-16 11:49 -0600
          Re: formats and endians BGB <cr88192@hotmail.com> - 2014-12-16 21:37 -0600
            Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-17 01:08 -0800
              Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-17 02:42 -0800
            Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-18 14:38 -0600
              Re: formats and endians Rosario193 <Rosario@invalid.invalid> - 2014-12-18 23:09 +0100
              Re: formats and endians BGB <cr88192@hotmail.com> - 2014-12-18 16:52 -0600
          Re: formats and endians Kleuske <kleuske@nowhere.net> - 2014-12-17 11:11 +0000
            Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-17 03:49 -0800
            Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-18 16:28 -0600
              Re: formats and endians BGB <cr88192@hotmail.com> - 2014-12-18 19:38 -0600
              Re: formats and endians Kleuske <kleuske@nowhere.net> - 2014-12-21 14:17 +0000
                Re: formats and endians Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-22 02:19 -0800
                Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2015-01-15 12:18 -0600
                Re: formats and endians Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-01-15 22:35 +0000
                Re: formats and endians raltbos@xs4all.nl (Richard Bos) - 2015-01-20 16:06 +0000
                Re: formats and endians Barry Schwarz <schwarzb@dqel.com> - 2015-01-22 15:41 -0800
                Re: formats and endians Robert Wessel <robertwessel2@yahoo.com> - 2015-01-23 00:45 -0600
                Re: formats and endians Richard Heathfield <invalid@see.sig.invalid> - 2015-01-23 08:52 +0000
                Re: formats and endians Robert Wessel <robertwessel2@yahoo.com> - 2015-01-23 05:47 -0600
                Re: formats and endians Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-01-23 03:51 -0800
                Re: formats and endians Bartc <bc@freeuk.com> - 2015-01-23 12:18 +0000
                Re: formats and endians raltbos@xs4all.nl (Richard Bos) - 2015-01-23 13:49 +0000
                Re: formats and endians fir <profesor.fir@gmail.com> - 2015-01-23 07:02 -0800
                Re: formats and endians fmassei@gmail.com - 2015-01-23 07:39 -0800
                Re: formats and endians Lowell Gilbert <lgusenet@be-well.ilk.org> - 2015-01-23 10:38 -0500
                Re: formats and endians Greg Martin <greg.at.softsprocket@dot.com> - 2015-01-23 17:45 +0000
                Re: formats and endians James Kuyper <jameskuyper@verizon.net> - 2015-01-23 12:59 -0500
                Re: formats and endians Greg Martin <greg.at.softsprocket@dot.com> - 2015-01-23 18:30 +0000
                Re: formats and endians James Kuyper <jameskuyper@verizon.net> - 2015-01-26 12:35 -0500
                Re: formats and endians Richard Heathfield <invalid@see.sig.invalid> - 2015-01-26 18:15 +0000
                Re: formats and endians Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-01-26 10:53 -0800
                Re: formats and endians Richard Heathfield <invalid@see.sig.invalid> - 2015-01-26 19:06 +0000
                Re: formats and endians Les Cargill <lcargill99@comcast.com> - 2015-01-26 17:54 -0600
                Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2015-01-26 19:09 -0600
                Re: formats and endians Richard Heathfield <invalid@see.sig.invalid> - 2015-01-27 01:49 +0000
                Re: formats and endians James Kuyper <jameskuyper@verizon.net> - 2015-01-26 21:37 -0500
                Re: formats and endians raltbos@xs4all.nl (Richard Bos) - 2015-01-23 22:33 +0000
                Re: formats and endians Richard Heathfield <invalid@see.sig.invalid> - 2015-01-23 18:02 +0000
                Re: formats and endians Greg Martin <greg.at.softsprocket@dot.com> - 2015-01-23 18:50 +0000
                Re: formats and endians glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-01-24 00:01 +0000
                Re: formats and endians raltbos@xs4all.nl (Richard Bos) - 2015-01-24 10:05 +0000
                Re: formats and endians glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-01-24 11:57 +0000
                Re: formats and endians Geoff <geoff@invalid.invalid> - 2015-01-24 07:48 -0800
                Re: formats and endians Bartc <bc@freeuk.com> - 2015-01-24 10:43 +0000
                Re: formats and endians Geoff <geoff@invalid.invalid> - 2015-01-24 07:52 -0800
                Re: formats and endians raltbos@xs4all.nl (Richard Bos) - 2015-01-23 13:51 +0000
      Re: formats and endians John Bode <jfbode1029@gmail.com> - 2014-12-16 06:56 -0800
    Re: formats and endians Robert Wessel <robertwessel2@yahoo.com> - 2014-12-16 13:20 -0600
      Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-16 18:00 -0600
        Re: formats and endians "Bill Cunningham" <nospam@nspam.invalid> - 2014-12-17 16:32 -0500
  Re: formats and endians David Brown <david.brown@hesbynett.no> - 2014-12-16 15:26 +0100
    Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 06:57 -0800
      Re: formats and endians Lowell Gilbert <lgusenet@be-well.ilk.org> - 2014-12-16 11:34 -0500
        Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 08:47 -0800
          Re: formats and endians BartC <bc@freeuk.com> - 2014-12-16 17:02 +0000
            Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 10:49 -0800
              Re: formats and endians BartC <bc@freeuk.com> - 2014-12-16 19:10 +0000
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 11:28 -0800
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 11:43 -0800
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 11:58 -0800
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 12:20 -0800
                Re: formats and endians BartC <bc@freeuk.com> - 2014-12-16 20:21 +0000
                Re: formats and endians Keith Thompson <kst-u@mib.org> - 2014-12-16 13:08 -0800
                Re: formats and endians Richard Heathfield <invalid@see.sig.invalid> - 2014-12-16 21:19 +0000
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 13:27 -0800
                Re: formats and endians Tim Rentsch <txr@alumni.caltech.edu> - 2014-12-16 16:41 -0800
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 13:22 -0800
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 14:00 -0800
                Re: formats and endians BartC <bc@freeuk.com> - 2014-12-16 22:26 +0000
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 14:54 -0800
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 15:09 -0800
                Re: formats and endians BartC <bc@freeuk.com> - 2014-12-16 20:08 +0000
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 12:48 -0800
            Re: formats and endians Kaz Kylheku <kaz@kylheku.com> - 2014-12-16 22:21 +0000
              Re: formats and endians BartC <bc@freeuk.com> - 2014-12-16 22:39 +0000
                Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 15:32 -0800
                Re: formats and endians glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-17 00:51 +0000
                Re: formats and endians BartC <bc@freeuk.com> - 2014-12-17 11:04 +0000
                Re: formats and endians glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-17 17:04 +0000
          Re: formats and endians Lowell Gilbert <lgusenet@be-well.ilk.org> - 2014-12-16 12:29 -0500
          Re: formats and endians Ken Brody <kenbrody@spamcop.net> - 2014-12-16 12:40 -0500
            Re: formats and endians Lowell Gilbert <lgusenet@be-well.ilk.org> - 2014-12-16 13:10 -0500
              Re: formats and endians Kaz Kylheku <kaz@kylheku.com> - 2014-12-16 18:35 +0000
                Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-16 12:57 -0600
                Re: formats and endians Lowell Gilbert <lgusenet@be-well.ilk.org> - 2014-12-16 15:11 -0500
                Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-16 18:10 -0600
            Re: formats and endians fir <profesor.fir@gmail.com> - 2014-12-16 10:51 -0800
            Re: formats and endians glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-16 19:43 +0000
        Re: formats and endians Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-16 10:37 -0800
          Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-16 13:05 -0600
            Re: formats and endians Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-16 11:49 -0800
              Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-16 17:16 -0600
          Re: formats and endians Lowell Gilbert <lgusenet@be-well.ilk.org> - 2014-12-16 14:55 -0500
            Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-16 17:48 -0600
              Re: formats and endians BGB <cr88192@hotmail.com> - 2014-12-17 00:18 -0600
                Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-20 12:21 -0600
                Re: formats and endians BGB <cr88192@hotmail.com> - 2014-12-22 01:38 -0600
      Re: formats and endians Stephen Sprunk <stephen@sprunk.org> - 2014-12-16 11:45 -0600
    Re: formats and endians Michael Angelo Ravera <maravera@prodigy.net> - 2014-12-18 16:50 -0800
  Re: formats and endians Nobody <nobody@nowhere.invalid> - 2014-12-17 04:51 +0000
    Re: formats and endians Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-19 10:16 -0800

csiph-web