From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: oops? read/write vs type of length parameter Date: Mon, 11 Apr 2011 17:02:43 +0300 Message-ID: <8339losx6k.fsf@gnu.org> References: <87wrj1jhfc.fsf@rho.meyering.net> <87d3ktjb9l.fsf@rho.meyering.net> <877hb1j7lz.fsf@rho.meyering.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1302530862 16816 80.91.229.12 (11 Apr 2011 14:07:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Apr 2011 14:07:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: Jim Meyering Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 11 16:07:38 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q9HmD-0001he-N1 for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 16:07:38 +0200 Original-Received: from localhost ([127.0.0.1]:56983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9HmC-00073S-7h for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 10:07:36 -0400 Original-Received: from [140.186.70.92] (port=49412 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9HjD-0005eS-IL for emacs-devel@gnu.org; Mon, 11 Apr 2011 10:04:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9Hj7-0001Pt-W9 for emacs-devel@gnu.org; Mon, 11 Apr 2011 10:04:30 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:63880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9Hj7-0001Pm-MT for emacs-devel@gnu.org; Mon, 11 Apr 2011 10:04:25 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0LJH00900R26CN00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Mon, 11 Apr 2011 17:04:24 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.127.31.148]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LJH009XJR3A1S50@a-mtaout21.012.net.il>; Mon, 11 Apr 2011 17:04:24 +0300 (IDT) In-reply-to: <877hb1j7lz.fsf@rho.meyering.net> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138393 Archived-At: > From: Jim Meyering > Cc: emacs-devel@gnu.org > Date: Mon, 11 Apr 2011 14:27:36 +0200 > > > That would be a major inconvenience, and even annoyance: in Emacs, it > > is a very frequent idiom to pass the result of subtracting two > > EMACS_INT values, because we reference buffers and strings with such > > values. Having the argument as unsigned type would trigger warnings > > and will need explicit type casts. And with type casts, there's the > > danger of interpreting a negative value as a large positive one. > > >From my experience with signedness-related warnings, > it is counterproductive to enable options like -Wsign-conversion > and -Wsign-compare, unless you're prepared to cherry-pick fixes for > the few "real" problems and to ignore the others. I agree, but unfortunately -Wall includes warnings about signedness, and I sometimes use -Wall to make sure I didn't miss something potentially bad. And there's no way of knowing what some future version of GCC will do to save us from ourselves ;-) > Adding casts to work around them makes the "cure" worse than the > disease. Right, which is why I didn't want to use them. > What about when EMACS_INT is defined to "int"? David answered that: the result would be less grave than the other way around.