Date: Sun, 20 Oct 2002 13:44:09 -0600 (MDT) From: "M. Warner Losh" <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 Message-ID: <20021020.134409.73085448.imp@bsdimp.com> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20021016121455.A3711@chiark.greenend.org.uk>
Tony Finch <dot@dotat.at> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021020.134409.73085448.imp>
