From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How and when to use GCPRO? Date: Mon, 27 Dec 2010 21:17:42 -0500 Message-ID: References: <4D193E60.8070108@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1293502675 32179 80.91.229.12 (28 Dec 2010 02:17:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 28 Dec 2010 02:17:55 +0000 (UTC) Cc: Andreas Schwab , Leo , emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 28 03:17:51 2010 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 1PXP8H-00022n-R3 for ged-emacs-devel@m.gmane.org; Tue, 28 Dec 2010 03:17:50 +0100 Original-Received: from localhost ([127.0.0.1]:48890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXP8G-0004OU-Q8 for ged-emacs-devel@m.gmane.org; Mon, 27 Dec 2010 21:17:48 -0500 Original-Received: from [140.186.70.92] (port=46754 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXP8D-0004OP-By for emacs-devel@gnu.org; Mon, 27 Dec 2010 21:17:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXP8C-0002qx-9I for emacs-devel@gnu.org; Mon, 27 Dec 2010 21:17:45 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:50447 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXP8C-0002qq-0Q for emacs-devel@gnu.org; Mon, 27 Dec 2010 21:17:44 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAO7XGE3O+LP+/2dsb2JhbACkLXS/SYVKBIRljhs X-IronPort-AV: E=Sophos;i="4.60,237,1291611600"; d="scan'208";a="86584591" Original-Received: from 206-248-179-254.dsl.teksavvy.com (HELO ceviche.home) ([206.248.179.254]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 27 Dec 2010 21:17:42 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 7638F6610E; Mon, 27 Dec 2010 21:17:42 -0500 (EST) In-Reply-To: <4D193E60.8070108@gmail.com> (Daniel Colascione's message of "Mon, 27 Dec 2010 17:33:20 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:133996 Archived-At: >>>> Actually, both Fcar and Fcdr can GC (by signalling an error which >>>> triggers the debugger). >>> But the debugger will not return. >> Oh, right, > Discussions like this worry me. What if the function is later changed to > call something that can GC? What if it's used in some new context? If > it's not utterly performance-critical code, isn't it better to be safe > than sorry and GCPRO anyway? It's not as if it's an expensive operation. > Premature optimization is the root of all evil, after all. On most platforms, GCPRO is a no-op, and on those where it's not, it's never been a major performance issue, AFAIK. The problem is just that it makes the code that much more verbose and painful to write/read/maintain. Stefan