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: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,582dff0b3f065a52 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,582dff0b3f065a52 X-Google-Attributes: gid109fba,public X-Google-ArrivalTime: 2001-08-25 22:16:58 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: pete Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Subject: Re: Subtle Bugs, kudos Ada (was How Ada ...Red Code ...) Date: Sun, 26 Aug 2001 01:16:33 -0400 Organization: PF Message-ID: <3B888631.204F@mindspring.com> 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> <30Yh7.54069$l7.6430776@typhoon.nyc.rr.com> Reply-To: pfiland@mindspring.com NNTP-Posting-Host: 3f.35.7c.8a Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 26 Aug 2001 05:16:34 GMT X-Mailer: Mozilla 3.04Gold (Win95; I) Xref: archiver1.google.com comp.lang.ada:12423 comp.lang.c:76931 comp.lang.c++:85711 Date: 2001-08-26T05:16:34+00:00 List-Id: Igor Tandetnik wrote: > > "Joe Maun" wrote in message > news:3B8462C8.5596C089@yahoo.com... > > Kaz Kylheku wrote: > > > Also, shifting right a signed quantity whose sign bit is 1 is > > > implementation-defined; > > > > This doesn't matter in this case. The value that the vacated bits take > > is indeed implementation defined, but the sign bit must reliably be > > shifted into the required position, since nothing frees it from the > > requirement that "The result of E1 >> E2 is E1 right-shifted E2 bit > > positions". > > > > > I think it's undefined in C99. > > > > No, it isn't. > > I don't know. C99 says: > "If E1 has a signed type and a negative value, > the resulting value is implementation-defined." > It says the whole result of the shift is implementation-defined, > not that the bits to the left of original bits are > implementation-defined. I don't see any guarantee that original > bits have to be preserved. > C++ standard has the same exact wording. The propagation of the high order bit when a signed integer is shifted right is THE example of implementation-defined behavior. -- pete