From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,582dff0b3f065a52 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,582dff0b3f065a52 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-27 21:50:42 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshub2.home.com!news.home.com!news1.rdc1.bc.home.com.POSTED!not-for-mail From: kaz@ashi.footprints.net (Kaz Kylheku) Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Subject: Re: Subtle Bugs, kudos Ada (was How Ada ...Red Code ...) References: <3B6555ED.9B0B0420@sneakemail.com> <87n15lxzzv.fsf@deneb.enyo.de> <3B672322.B5EA1B66@home.com> <4a885870.0108112341.7ce02ac0@posting.google.com> <3B834E5D.B0D26AB1@adaworks.com> <9lvsic$bet9s$1@ID-9852.news.dfncis.de> <9m0193$grs$1@bird.wu-wien.ac.at> <3B83F042.4CFB073D@home.com> <3B8462C8.5596C089@yahoo.com> <87n14nmbf8.fsf@deneb.enyo.de> <3B89A809.46083436@yahoo.com> <871ylxpxu6.fsf@deneb.enyo.de> <3B8AA131.3FCC0E9A@yahoo.com> <87g0ad44ab.fsf@deneb.enyo.de> <3B8B1130.97FFDD66@yahoo.com> Organization: Psycho-Neurotic Institute for the Very, Very Nervous Reply-To: kaz@ashi.footprints.net User-Agent: slrn/0.9.6.3 (Linux) Message-ID: Date: Tue, 28 Aug 2001 04:50:42 GMT NNTP-Posting-Host: 24.68.85.82 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.bc.home.com 998974242 24.68.85.82 (Mon, 27 Aug 2001 21:50:42 PDT) NNTP-Posting-Date: Mon, 27 Aug 2001 21:50:42 PDT Xref: archiver1.google.com comp.lang.ada:12501 comp.lang.c:77158 comp.lang.c++:86123 Date: 2001-08-28T04:50:42+00:00 List-Id: In article <3B8B1130.97FFDD66@yahoo.com>, Joe Maun wrote: >Florian Weimer wrote: >> >> Joe Maun writes: >> >> > I fail to see your point. Why wouldn't the sign bit be shifted right in >> > sign magnitude representation? The quote from the standard above seems >> > clear - and it applies to a signed magnitude implementation as well. >> >> What about this quote from the standard, then? >> >> | 3.4.1 >> | [#1] implementation-defined behavior >> | unspecified behavior where each implementation documents how >> | the choice is made >> | >> | [#2] EXAMPLE An example of implementation-defined behavior >> | is the propagation of the high-order bit when a signed >> | integer is shifted right. > >I'm afraid you missed the point. As has already been pointed out, the >discussion isn't about the new high-order bits that the shift >introduces, which is what the quote above mentions. Everybody agrees >that that's implementation defined. The question is what about the bits >that already exist - are they guaranteed to be reliably shifted right? I >say yes, some say no. I have a C99 draft copy which says: ``If E1 has a signed type, and a negative value, the resulting value is implementation-defined.'' What is so hard to understand about this? There is absolutely no ambiguity about what it means for a resulting value to be implementation-defined. This is not some gray area of the language about which only experts can have doubts. Implementation-defined could mean that the value 42 is always computed regardless of the value of the remaining bits, or the shift amount. If the intent was only to leave the treatment of the sign bit to the implementors, then the text would say something else entirely, like perhaps ``If E1 has a signed type and a negative value, it is implementation-defined whether or not the sign bit is involved in the shift operation. If it is involved, it's implementation-defined whether or not it is replaced by a 1 or 0 bit''. >If anything, the quote above strongly hints that the intention of the >standard is as I argue, since it only mentions the propagation of the >_high order bit_ as implementation defined. Computing the value 42 is a perfect example of such propagation. The sign bit propagates to bit positions 1, 3 and 4. Its complemented value propagates to all other bits.