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


Groups > comp.lang.c > #93884

Re: Portable 16 bit binary integer write

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: Portable 16 bit binary integer write
Date 2016-09-22 09:49 +0200
Organization A noiseless patient Spider
Message-ID <ns02d8$5cl$1@dont-email.me> (permalink)
References (16 earlier) <09cb4413-16a6-4b63-89d0-9dafe56562f6@googlegroups.com> <lnfuozz3ea.fsf@kst-u.example.com> <68e53f3a-5fcc-44fc-90c4-bcf8dc3db680@googlegroups.com> <ln7faayyhf.fsf@kst-u.example.com> <kfnh998fuoa.fsf@x-alumni2.alumni.caltech.edu>

Show all headers | View raw


On 22/09/16 06:03, Tim Rentsch wrote:
> Keith Thompson <kst-u@mib.org> writes:
> 
>> [...]
>>
>> Perhaps it's time for the next edition of the C standard to mandate
>> 2's-complement [...]
> 
> I see no reason to do so, and in fact would express it more
> strongly - it is IMO philosophically wrongheaded.  Most
> applications don't care.  Any that do care can easily enforce
> that they will compile only on 2's complement implementations.
> Obviously it is an advantage for the language to be available
> as widely as possible, including on hardware that employs
> alternate representation schemes.  Arbitrarily excluding such
> hardware would be a poor choice for C, which IIANM is available
> on a more diverse range of hardware than any other programming
> language.  That is one of C's most important strengths - any
> move in a direction that would weaken that should be viewed
> with suspicion.
> 

In general, I agree with you - the support for a wide range of
architectures is a strength of C.  But consider this:

1. There are no architectures that use anything other than two's
complement, except for a few dinosaur mainframes, which are irrelevant
for the future of C (they can keep their existing C compilers).  It is
reasonable to expect that no new processors will be made that use
anything other than two's complement for their signed integer
representation.  (Please mention any counter-examples you know of.)

2. Restricting a future C standard to two's complement would simplify
the standard.

3. There are a few programs or types of code that rely on two's
complement representation.  If this were standardised, it would be much
easier to write such code in a portable way.

4. There are /many/ programs that unknowingly rely on two's complement
representation - anything that deals with external binary formats
(network protocols, file formats, interfacing to other languages, etc.)
will use two's complement.  Programs that use such data are likely to do
so in a way that relies on two's complement formats without explicitly
stating the requirements.


There is no doubt that placing new restrictions on the hardware for C is
not a decision to be taken lightly.  But fixing on two's complement
representation has clear advantages (albeit for only a small fraction of
code - most code does not care), and no practical real-world
disadvantages.  To me, the question is not whether it would be a good
idea or not - the answer is obvious.  The question is merely if it is a
useful enough idea to be worth the not insignificant effort required to
make such a change in the C standards.

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


Thread

Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-10 14:23 -0700
  Re: Portable 16 bit binary integer write Barry Schwarz <schwarzb@dqel.com> - 2016-09-10 17:11 -0700
  Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-11 07:00 -0700
  Re: Portable 16 bit binary integer write Richard Damon <Richard@Damon-Family.org> - 2016-09-13 08:41 -0400
    Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-13 06:24 -0700
      Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-13 16:19 +0200
        Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-13 10:20 -0700
          Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-13 11:07 -0700
        Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-13 20:47 -0700
          Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-14 08:24 -0700
            Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-15 12:17 -0700
          Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-15 11:27 +0200
            Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-15 09:03 -0700
              Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-15 11:21 -0700
              Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-15 18:39 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-15 12:26 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-15 23:12 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-15 16:17 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-15 18:35 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-16 11:10 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-16 08:43 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-16 19:59 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-16 13:34 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-16 16:23 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-16 15:31 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-16 19:06 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-16 23:27 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-17 15:04 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-17 20:35 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-18 00:09 -0700
                Re: Portable 16 bit binary integer write Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-18 19:36 +0100
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-18 15:29 -0700
                Re: Portable 16 bit binary integer write Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-19 01:20 +0100
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-18 09:48 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-18 19:38 +0200
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-18 15:33 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-18 13:58 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-18 14:15 -0700
                Re: Portable 16 bit binary integer write BartC <bc@freeuk.com> - 2016-09-18 23:15 +0100
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-18 15:46 -0700
                Re: Portable 16 bit binary integer write Ian Collins <ian-news@hotmail.com> - 2016-09-19 17:03 +1200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-19 07:40 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-19 10:54 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-19 10:51 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-19 22:03 +0200
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-19 15:44 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-20 09:02 +0200
                Re: Portable 16 bit binary integer write BartC <bc@freeuk.com> - 2016-09-19 21:12 +0100
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-19 15:58 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-19 09:49 +0200
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-19 02:37 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-19 13:20 +0200
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-19 06:22 -0700
                Re: Portable 16 bit binary integer write BartC <bc@freeuk.com> - 2016-09-19 12:46 +0100
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-19 16:20 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-19 07:32 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-19 11:26 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-19 09:10 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-19 09:33 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-19 11:54 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-19 22:14 +0200
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-19 22:12 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-19 14:32 -0700
                Re: Portable 16 bit binary integer write Robert Wessel <robertwessel2@yahoo.com> - 2016-09-19 22:58 -0500
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-20 09:45 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-20 07:49 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-20 19:43 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-20 11:15 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-19 22:36 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-22 21:30 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-22 23:58 -0700
                Re: Portable 16 bit binary integer write Ian Collins <ian-news@hotmail.com> - 2016-09-23 19:45 +1200
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-28 08:17 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-28 09:59 -0700
                Re: Portable 16 bit binary integer write Ian Collins <ian-news@hotmail.com> - 2016-09-29 07:59 +1300
                Re: Portable 16 bit binary integer write Ike Naar <ike@iceland.freeshell.org> - 2016-09-28 19:26 +0000
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-28 12:37 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-10-09 03:46 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-18 13:53 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-21 21:03 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-21 22:23 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-22 08:09 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-23 10:31 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-23 10:56 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-29 08:03 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-30 07:39 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-22 09:49 +0200
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-22 08:34 -0700
                Re: Portable 16 bit binary integer write BartC <bc@freeuk.com> - 2016-09-22 17:44 +0100
                Re: Portable 16 bit binary integer write Melzzzzz <Melzzzzz@zzzzz.com> - 2016-09-22 17:16 +0000
                Re: Portable 16 bit binary integer write BartC <bc@freeuk.com> - 2016-09-22 18:26 +0100
                Re: Portable 16 bit binary integer write Melzzzzz <Melzzzzz@zzzzz.com> - 2016-09-22 17:33 +0000
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-23 10:23 +0200
                Re: Portable 16 bit binary integer write Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-23 13:43 +0100
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-23 14:58 +0200
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-22 18:14 -0700
                Re: Portable 16 bit binary integer write luser droog <luser.droog@gmail.com> - 2016-09-22 20:28 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-23 00:12 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-22 10:57 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-23 10:18 +0200
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-23 11:48 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-23 15:58 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-29 08:21 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-30 07:42 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-23 23:38 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-24 11:42 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-24 14:13 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-24 23:03 -0700
                Re: Portable 16 bit binary integer write Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-25 11:29 +0100
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-25 14:02 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-25 15:17 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-25 16:52 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-25 13:59 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-25 15:13 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-25 15:50 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-28 08:13 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-24 16:06 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-24 11:53 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-24 14:23 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-25 14:16 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-25 15:18 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-25 16:39 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-25 23:33 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-26 02:08 -0700
                Re: Portable 16 bit binary integer write Richard Heathfield <rjh@cpax.org.uk> - 2016-09-26 10:25 +0100
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-26 03:05 -0700
                Re: Portable 16 bit binary integer write Richard Heathfield <rjh@cpax.org.uk> - 2016-09-26 11:09 +0100
                Re: Portable 16 bit binary integer write "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-09-26 09:29 -0700
                Re: Portable 16 bit binary integer write Richard Heathfield <rjh@cpax.org.uk> - 2016-09-26 17:37 +0100
                Re: Portable 16 bit binary integer write "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-09-26 12:29 -0700
                Re: Portable 16 bit binary integer write BartC <bc@freeuk.com> - 2016-09-26 11:12 +0100
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-26 13:19 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-26 18:34 -0700
                Re: Portable 16 bit binary integer write Ike Naar <ike@iceland.freeshell.org> - 2016-09-27 06:43 +0000
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-27 00:51 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-27 08:42 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-22 11:40 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-23 10:00 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-23 10:34 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-29 08:13 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-18 00:06 +0200
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-17 17:32 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-18 15:57 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-17 20:46 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-18 16:08 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-18 10:03 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-17 23:59 +0200
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-17 16:49 -0700
                Re: Portable 16 bit binary integer write Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-18 01:19 +0100
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-18 07:16 -0700
                Re: Portable 16 bit binary integer write "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-18 10:19 -0400
                Re: Portable 16 bit binary integer write luser droog <luser.droog@gmail.com> - 2016-09-18 13:26 -0700
                Re: Portable 16 bit binary integer write "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-18 17:04 -0400
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-22 01:21 -0700
            Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-15 12:07 -0700
              Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-16 00:32 +0200
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-15 16:30 -0700
                Re: Portable 16 bit binary integer write Keith Thompson <kst-u@mib.org> - 2016-09-15 18:35 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-15 22:00 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-15 22:17 -0700
                Re: Portable 16 bit binary integer write Ian Collins <ian-news@hotmail.com> - 2016-09-16 18:12 +1200
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-16 00:46 -0700
                Re: Portable 16 bit binary integer write Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-16 10:23 +0100
                Re: Portable 16 bit binary integer write BartC <bc@freeuk.com> - 2016-09-16 10:59 +0100
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-16 04:13 -0700
                Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-16 08:58 -0700
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-16 10:16 -0700
                Re: Portable 16 bit binary integer write Tim Rentsch <txr@alumni.caltech.edu> - 2016-09-16 09:11 -0700
                Re: Portable 16 bit binary integer write David Brown <david.brown@hesbynett.no> - 2016-09-16 20:14 +0200
                Re: Portable 16 bit binary integer write Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-16 20:37 -0700
      Re: Portable 16 bit binary integer write supercat@casperkitty.com - 2016-09-13 07:47 -0700

csiph-web