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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,582dff0b3f065a52 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,582dff0b3f065a52 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-28 10:13:21 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!tor-nx1.netcom.ca!tor-nn1.netcom.ca.POSTED!not-for-mail Message-ID: <3B8BD171.32C155D2@yahoo.com> From: Joe Maun Organization: H X-Mailer: Mozilla 4.77 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 28 Aug 2001 13:14:25 -0400 NNTP-Posting-Host: 216.123.128.152 X-Complaints-To: abuse@attcanada.ca X-Trace: tor-nn1.netcom.ca 999018791 216.123.128.152 (Tue, 28 Aug 2001 13:13:11 EDT) NNTP-Posting-Date: Tue, 28 Aug 2001 13:13:11 EDT Xref: archiver1.google.com comp.lang.ada:12527 comp.lang.c:77248 comp.lang.c++:86247 Date: 2001-08-28T13:14:25-04:00 List-Id: Kaz Kylheku wrote: > > In article <3B8B1130.97FFDD66@yahoo.com>, Joe Maun wrote: [...] > >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. Right. However, while the value computed is implementation-defined, the state of some bits is not necessarily so. Unlike most other operators, the shift operators are defined both in terms of bits *and* values, two different concepts. When a particular aspect of the standard is implementation defined, the behavior chosen by the implementation has no license to violate a different aspect of the standard. So while the *whole* value is indeed implementation defined (there is no such thing as a partial value), I don't see where it gets the license to violate "The result of E1 >> E2 is E1 right-shifted E2 bit positions", which is not specified in terms of values but in terms of bits. So while the value of the expression is explicitly implementation defined, the state of the bits that existed before the shift are well defined by the first sentence of that clause, which is _not_ contradicted by the quote "the resulting value is implementation-defined", since they are two different aspects of the shift operators. > This is not some gray area of > the language about which only experts can have doubts. Obviously, since I too have doubts. Since you mentioned "experts", it may be interesting to point out that I changed my position on this after I was corrected by Lawrence K. when I claimed as you do now. See: http://groups.google.com/groups?as_umsgid=984786377snz%40genesis.demon.co.uk For a definitive answer (or more likely endless debate) perhaps this should be posted to comp.std.c(++). -- Joe Maun Montreal, QC Canada