From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyiTp-0000ZG-GF for qemu-devel@nongnu.org; Tue, 17 Nov 2015 10:47:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyiTk-00077T-Ow for qemu-devel@nongnu.org; Tue, 17 Nov 2015 10:47:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40289) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyiTk-00077O-Jl for qemu-devel@nongnu.org; Tue, 17 Nov 2015 10:47:32 -0500 From: Markus Armbruster References: <1447769349-1767-1-git-send-email-pbonzini@redhat.com> <564B3E19.50804@redhat.com> Date: Tue, 17 Nov 2015 16:47:29 +0100 In-Reply-To: <564B3E19.50804@redhat.com> (Laszlo Ersek's message of "Tue, 17 Nov 2015 15:47:53 +0100") Message-ID: <87y4dwljam.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: Paolo Bonzini , qemu-devel@nongnu.org, Peter Maydell Laszlo Ersek writes: > I accept this is a defensible, maybe even reasonable choice to make in > the QEMU project. On the other hand, I personally cannot stop hating > shifting negative values (any direction) -- indeed, the *original* code > from makes me barf too. > > Therefore, > > Grudgingly-reviewed-by: Laszlo Ersek > > (I realize the flag for the pointer wraparound has been separated; this > is strictly about shifts.) What's so abhorrent about shifting negative values? I know machines with signed integer representations other than twos complement exist, as do machines that can't do both logical and arithmetic shifts. Mostly inside computer museums, though. C was standardized at a time when keeping the language sufficiently loose to permit efficient implementation on these oddball machines made a lot more sense than it does now. Making it undefined behavior went too far, though. Implementation-defined or unspecified behavior would have sufficed. Learn to stop worrying and love the signed shifts :)