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: System calls without error checks in w32 Date: Sun, 30 May 2010 20:36:14 +0300 Message-ID: <83hblpthpt.fsf@gnu.org> References: <83ocfytxhg.fsf@gnu.org> <83mxvitsay.fsf@gnu.org> <83ljb2tn6i.fsf@gnu.org> <83k4qmt7lb.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1275241105 1314 80.91.229.12 (30 May 2010 17:38:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 30 May 2010 17:38:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 30 19:38:23 2010 connect(): No such file or directory 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 1OImRW-0001xX-CU for ged-emacs-devel@m.gmane.org; Sun, 30 May 2010 19:38:21 +0200 Original-Received: from localhost ([127.0.0.1]:42116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OImRL-0003iu-7b for ged-emacs-devel@m.gmane.org; Sun, 30 May 2010 13:36:47 -0400 Original-Received: from [140.186.70.92] (port=34061 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OImRD-0003UD-Iv for emacs-devel@gnu.org; Sun, 30 May 2010 13:36:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OImR8-0008E4-6t for emacs-devel@gnu.org; Sun, 30 May 2010 13:36:35 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:42384) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OImR7-0008D6-Th for emacs-devel@gnu.org; Sun, 30 May 2010 13:36:34 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0L3800800U5L0X00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Sun, 30 May 2010 20:36:13 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.127.245.238]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L38007SYU8CYF00@a-mtaout21.012.net.il>; Sun, 30 May 2010 20:36:13 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:125364 Archived-At: > From: Lennart Borgman > Date: Sun, 30 May 2010 05:26:32 +0200 > Cc: emacs-devel@gnu.org > > On Sun, May 30, 2010 at 5:02 AM, Eli Zaretskii wrote: > > > > In any case, the solution you suggest is not a good one, because it > > obfuscates the source code and makes it harder to read and understand. > > > Are you saying that checking the return values of system calls should > be avoided because it makes the code to difficult to read? No. > Remember that what I suggest is basically > > if (bad_return_value) DebPrint (("error this_function.ApiFunction > => %d", bad_return_value)); What purpose does this serve? This isn't "checking return values for errors", because this has no effect for the majority of users who don't run Emacs under a debugger. Their Emacs will still crash if it hits bad_return_value. I thought you were arguing for making the Emacs code more robust in the face of possible failures of the APIs it calls. If you want more debugging aids, I don't object, but then I have no interest in such additions, either. Typically, such additions are only good as long as you debug some specific problem, so keeping them in the code after that is waste of bytes. > W32DEBPRINT (this_function, ApiFunction, bad_return_value, 0); This is even worse, because it's impossible to understand what this does without looking up the magical W32DEBPRINT macro.