From owner-freebsd-standards Sun Oct 20 12:44:45 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5B13B37B401; Sun, 20 Oct 2002 12:44:44 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 803E843E9C; Sun, 20 Oct 2002 12:44:43 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.3/8.12.3) with ESMTP id g9KJiMpk075829; Sun, 20 Oct 2002 13:44:22 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 20 Oct 2002 13:44:09 -0600 (MDT) Message-Id: <20021020.134409.73085448.imp@bsdimp.com> To: dot@dotat.at Cc: tlambert2@mindspring.com, bde@zeta.org.au, rodrigc@attbi.com, freebsd-standards@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: Problem detecting POSIX symbolic constants From: "M. Warner Losh" In-Reply-To: <20021016121455.A3711@chiark.greenend.org.uk> References: <20021012151336.A24868@chiark.greenend.org.uk> <3DA883F2.33E84C@mindspring.com> <20021016121455.A3711@chiark.greenend.org.uk> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <20021016121455.A3711@chiark.greenend.org.uk> Tony Finch writes: : On Sat, Oct 12, 2002 at 01:20:03PM -0700, Terry Lambert wrote: : > Tony Finch wrote: : > > : > > No -- the short-circuiting behaviour of && and || only matters if : > > you can have side-effects, which you can't in the preprocessor, : > > so there is no need to implement it (unifdef doesn't). : > : > Consider: : > : > #if _DEFINED_SUPPORTED && defined(SOMETHING) : : That's a syntax error in pre-ANSI preprocessors (unless defined() is : #defined), which won't be bypassed by evaluation shortcutting since : evaluation happens after parsing. Actaully, it is only a syntax error on some really really really old cpp. The sun cpp on SunOS 4.x, for example, wasn't ANSI, but did grok the above construct. Warner P.S. % uname -a SunOS hostname 4.1C 4.1.3 sun4 % cc -E foo.c # 1 "foo.c" # 3 "foo.c" bar __STDC__ % cat foo.c #if nope && defined(baz) foo #else bar #endif __STDC__ % To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message