From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: Science to suppress compiler warnings Date: Wed, 3 Jun 2009 11:58:55 +0200 Message-ID: References: <87fxeigro9.wl%xma@gnu.org> <87zlcqgc5p.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1244023154 9753 80.91.229.12 (3 Jun 2009 09:59:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Jun 2009 09:59:14 +0000 (UTC) Cc: Xavier Maillard , emacs-devel@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 03 11:59:11 2009 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.50) id 1MBnFW-00049I-OU for ged-emacs-devel@m.gmane.org; Wed, 03 Jun 2009 11:59:11 +0200 Original-Received: from localhost ([127.0.0.1]:36647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBnFW-0004JS-73 for ged-emacs-devel@m.gmane.org; Wed, 03 Jun 2009 05:59:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MBnFO-0004J7-K0 for emacs-devel@gnu.org; Wed, 03 Jun 2009 05:59:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MBnFK-0004II-0B for emacs-devel@gnu.org; Wed, 03 Jun 2009 05:59:02 -0400 Original-Received: from [199.232.76.173] (port=47402 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBnFJ-0004IF-Qi for emacs-devel@gnu.org; Wed, 03 Jun 2009 05:58:57 -0400 Original-Received: from mail-bw0-f161.google.com ([209.85.218.161]:34880) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MBnFI-0006tP-CD; Wed, 03 Jun 2009 05:58:56 -0400 Original-Received: by bwz5 with SMTP id 5so9520099bwz.42 for ; Wed, 03 Jun 2009 02:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=mCW0ZibHbA4SkjmxwWXN8C/FBtvNsqF3lf/i6g95gJA=; b=X92yRROzLTlHsjiN7mtcFX3+mJHwXOcZAo8l7JhNa3/wlWCmVacVyaoEMZ3dkZMNOQ LSJE38OS6vQ7EbEn7AwStsa/DD73QABDEBGFR7YEJaxBFkrCfnuuTf9uqvMeJH/KPAuf +Nz5OKtR8yvI20VqywfFg5OG1EYOji6smfUoA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=eoE98DyiCp2gmq7U1Nhrn5+f76HdMkLrlzvcshz2mc8YuRozP+utvKOIvYF93B+C8t f6ZHPtGShJXrGTYEasV7hdoJeBjbdLL6u3ypahYCya0ghPBPesZr/t5A1/GaS7h8eazK qWJAtCG02sBOI6+ZFy+dDtGUTlGPdTaklSbIQ= Original-Received: by 10.239.136.143 with SMTP id h15mr59495hbh.106.1244023135167; Wed, 03 Jun 2009 02:58:55 -0700 (PDT) In-Reply-To: <87zlcqgc5p.fsf@uwakimon.sk.tsukuba.ac.jp> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:111310 Archived-At: On Wed, Jun 3, 2009 at 6:43 AM, Stephen J. Turnbull wr= ote: > Xavier Maillard writes: > > =C2=A0> Elisp manual at "Compiler Errors" section (16.6) says we should > =C2=A0> conditionalize variable use with a boundp test (same thing for > =C2=A0> undefined function) but I find it very unpractical. > > If this is related to your work on supporting old versions of Emacs, > my advice is "live with it". =C2=A0Either use the runtime test if it's an > Emacs-defined variable, or use an appropriate `defvar' or `defconst' > to initialize the variable. > > Suppressing compiler warnings is very likely to lead to runtime > errors, often intermittent ones. =C2=A0Eg, there may be an unusual code > path that leads to reference to a void variable very early in an Emacs > session. =C2=A0Boom! =C2=A0But unless you type that exact sequence of com= mands > immediately after starting Emacs, something requires the relevant > library, and no problem can be found. > > Such bugs are quite hard to diagnose, even to localize, if the user is > not an Emacs expert. =C2=A0A boundp check with a good error message, or a > proper initialization with `defvar', will prevent or at least help > diagnose a lot of problems. But if you combine (defvar foo) with tests everywhere foo is used you should be safe ...