Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: [OT] programming |
| Date | 2015-10-09 12:05 -0700 |
| Organization | None to speak of |
| Message-ID | <lnk2qvg8vs.fsf@kst-u.example.com> (permalink) |
| References | (4 earlier) <mv6ss4$t36$1@dont-email.me> <mv6tje$v5v$1@dont-email.me> <mv6v8u$41p$1@dont-email.me> <lnegh4hno2.fsf@kst-u.example.com> <cvORx.175733$WK.72446@fx10.iad> |
Richard Damon <Richard@Damon-Family.org> writes:
[...]
> We are now in an era where a lot of these 'weirdnesses' are just
> extremely uncommon, and many programmers have never experienced them. We
> also have an auxiliary standard, POSIX, which allows programmers to
> assume a lot of the common features (like 8 bit bytes, two's complement,
> etc), but it also imposes a lot of restrictions on services provided by
> the host operating system.
[...]
POSIX does require CHAR_BIT==8, but does it really require two's
complement?
In its description of <limits.h>, POSIX requires signed char to have a
range of at least -128 to +127, but the required ranges for short, int,
and long are symmetric; for example, SHRT_MAX can be -32767. That could
mean that one's complement and sign-and-magnitude are permitted, but it
could also mean that -32768 is allowed to be a trap representation.
(BTW, POSIX requires the range of int to be at least -2147483647 to
+2147483647.)
The POSIX description of the abs() function says
In two's-complement representation, the absolute value of the
negative integer with largest magnitude {INT_MIN} might not be
representable.
which could imply that two's-complement is optional.
Is there an explicit requirement in POSIX that signed integer types
(other than signed char, plain char if it's signed, and intN_t) must be
represented using 2's-complement?
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[OT] programming asetofsymbols@gmail.com - 2015-10-07 00:37 -0700
Re: [OT] programming mark.bluemel@gmail.com - 2015-10-07 00:49 -0700
Re: [OT] programming asetofsymbols@gmail.com - 2015-10-07 01:06 -0700
Re: [OT] programming Richard Heathfield <rjh@cpax.org.uk> - 2015-10-07 10:02 +0100
Re: [OT] programming Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-07 02:18 -0700
Re: [OT] programming "Bill Cunningham" <nospam@nspam.invalid> - 2015-10-08 19:07 -0400
Re: [OT] programming Richard Heathfield <rjh@cpax.org.uk> - 2015-10-09 00:20 +0100
Re: [OT] programming Bartc <bc@freeuk.com> - 2015-10-09 00:48 +0100
Re: [OT] programming Keith Thompson <kst-u@mib.org> - 2015-10-08 17:48 -0700
Re: [OT] programming David Brown <david.brown@hesbynett.no> - 2015-10-09 10:38 +0200
Re: [OT] programming Keith Thompson <kst-u@mib.org> - 2015-10-09 09:31 -0700
Re: [OT] programming Richard Damon <Richard@Damon-Family.org> - 2015-10-09 08:34 -0400
Re: [OT] programming Keith Thompson <kst-u@mib.org> - 2015-10-09 12:05 -0700
Re: [OT] programming Richard Heathfield <rjh@cpax.org.uk> - 2015-10-09 08:28 +0100
Re: [OT] programming David Brown <david.brown@hesbynett.no> - 2015-10-09 10:50 +0200
Re: [OT] programming Keith Thompson <kst-u@mib.org> - 2015-10-09 09:26 -0700
Re: [OT] programming David Brown <david.brown@hesbynett.no> - 2015-10-11 20:30 +0200
Re: [OT] programming Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-11 12:09 -0700
Re: [OT] programming Bartc <bc@freeuk.com> - 2015-10-09 10:40 +0100
Re: [OT] programming Keith Thompson <kst-u@mib.org> - 2015-10-09 09:23 -0700
Re: [OT] programming Bartc <bc@freeuk.com> - 2015-10-09 17:35 +0100
Re: [OT] programming Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-09 22:50 -0700
Re: [OT] programming David Brown <david.brown@hesbynett.no> - 2015-10-09 10:34 +0200
Re: [OT] programming glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-10-09 00:20 +0000
Re: [OT] programming "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-10-07 09:37 -0700
csiph-web