From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: inlinable functions instead of macros Date: Fri, 24 Aug 2012 19:38:09 -0600 Message-ID: <87y5l3iwe6.fsf@fleche.redhat.com> References: <502EDAF3.6030005@cs.ucla.edu> <5034A654.2080909@cs.ucla.edu> <5037F411.4010905@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1345858705 27413 80.91.229.3 (25 Aug 2012 01:38:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Aug 2012 01:38:25 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 25 03:38:25 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T55KP-0003Wl-Lc for ged-emacs-devel@m.gmane.org; Sat, 25 Aug 2012 03:38:21 +0200 Original-Received: from localhost ([::1]:60125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T55KO-0005mj-0M for ged-emacs-devel@m.gmane.org; Fri, 24 Aug 2012 21:38:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T55KJ-0005mW-HN for emacs-devel@gnu.org; Fri, 24 Aug 2012 21:38:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T55KI-0006JP-A5 for emacs-devel@gnu.org; Fri, 24 Aug 2012 21:38:15 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:44597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T55KI-0006JL-2U for emacs-devel@gnu.org; Fri, 24 Aug 2012 21:38:14 -0400 Original-Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7P1cBce027392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Aug 2012 21:38:11 -0400 Original-Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7P1c9sM001459 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 24 Aug 2012 21:38:10 -0400 X-Attribution: Tom In-Reply-To: <5037F411.4010905@cs.ucla.edu> (Paul Eggert's message of "Fri, 24 Aug 2012 14:37:21 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152822 Archived-At: >>>>> "Paul" == Paul Eggert writes: Paul> It's simple to put easserts into macros, but as you know this has Paul> problems that make the macros hard to use. They cannot be invoked Paul> from GDB, which complicates debugging. Why is that? I haven't been following this, but I wonder if there is a gdb deficiency we can easily address. Paul> More important, callers sometimes cannot specify arguments with Paul> side effects, and this restriction makes callers error-prone. Paul> We've tried to address some of the side-effect issues with this Paul> hack: Paul> /* The IDX==IDX tries to detect when the macro argument is side-effecting. */ Paul> #define ASET(ARRAY, IDX, VAL) \ Paul> (eassert ((IDX) == (IDX)), \ I've often wished that GCC had a __builtin_assert_no_side_effects for use in macros. Tom