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


Groups > comp.lang.c > #12979

Re: overflow problem?

From Greg <nospam@nospam.com>
Newsgroups comp.lang.c
Subject Re: overflow problem?
Date 2011-11-09 20:01 +0000
Organization Aioe.org NNTP Server
Message-ID <j9em77$fec$1@speranza.aioe.org> (permalink)
References <j9c9o3$fhi$1@speranza.aioe.org> <4EB9BAB6.7040504@verizon.net> <pan.2011.11.09.09.05.50.350000@nowhere.com> <j9dori$sil$1@dont-email.me>

Show all headers | View raw


James Kuyper writes:

> On 11/09/2011 04:05 AM, Nobody wrote:
>> On Tue, 08 Nov 2011 18:26:46 -0500, James Kuyper wrote:
>> 
>>> I'll assume, as you seem to be, that CHAR_BIT==8.
>> 
>> Actually, you appear to be assuming that CHAR_BIT==9 ;)
>> 
>>> If char is signed:
>>> If the bit pattern is 10000000, the '1' is presumably the sign bit.
>>> Which number it represents would depend upon which of the three
>>> representations allowed by C is used:
>>> 	sign and magnitude - negative zero
>>> 	two's complement: -256
>>> 	one's complement: -255
>> 
>> The last two should be -128 and -127 respectively for CHAR_BIT==8.
> 
> It seems like almost every post I've made for the past several days has
> had at least one silly stupid mistake. I guess I need a vacation.
> 
> Someone has been saving up a list of several dozen "undocumented data
> outages" for several years, and it suddenly occurred to them that maybe
> they should report all of these outages to someone who can actually
> investigate why they happened, in time for the start of Collection 6
> reprocessing. It's dull boring work, with no one I can delegate any of
> it to. The boredom is relieved only by the terror of worrying about
> whether one of the outages might turn out to be due to a defect in one
> of my programs which will need a last-minute fix.

Thanks to all who responded; that clears up what was going on.  As far as
it goes, I know I'm using undefined behaviour and taking advantage of the
way my particular compiler and operating system work together, and I know
this is severely frowned upon: that's why I didn't ask anyone to try and
follow the code through.  Nonetheless, had I not known it, I'd have
appreciated having it pointed out to me :) 

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


Thread

overflow problem? Greg <nospam@nospam.com> - 2011-11-08 22:16 +0000
  Re: overflow problem? Keith Thompson <kst-u@mib.org> - 2011-11-08 14:33 -0800
  Re: overflow problem? James Kuyper <jameskuyper@verizon.net> - 2011-11-08 18:26 -0500
    Re: overflow problem? Nobody <nobody@nowhere.com> - 2011-11-09 09:05 +0000
      Re: overflow problem? James Kuyper <jameskuyper@verizon.net> - 2011-11-09 06:40 -0500
        Re: overflow problem? Greg <nospam@nospam.com> - 2011-11-09 20:01 +0000
          Re: overflow problem? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-10 01:29 -0800

csiph-web