From owner-freebsd-hackers Sat Oct 12 1:47:30 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 25DC337B401; Sat, 12 Oct 2002 01:47:29 -0700 (PDT) Received: from pintail.mail.pas.earthlink.net (pintail.mail.pas.earthlink.net [207.217.120.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id BB8D743EA3; Sat, 12 Oct 2002 01:47:28 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0112.cvx22-bradley.dialup.earthlink.net ([209.179.198.112] helo=mindspring.com) by pintail.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 180Hva-0006a1-00; Sat, 12 Oct 2002 01:47:18 -0700 Message-ID: <3DA7E0F4.5988CA77@mindspring.com> Date: Sat, 12 Oct 2002 01:44:36 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Bruce Evans Cc: Craig Rodrigues , freebsd-standards@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: Problem detecting POSIX symbolic constants References: <20021012171803.F15910-100000@gamplex.bde.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bruce Evans wrote: > This book has lots of bugs (mostly from being too informal and/or > omitting necessary details). Note that section 15 doesn't even mention > "&&" and "||" working in non-cpp constant expressions. But they > cetainly worked in expressions, and expressions with only constants > in them are (informally) constant expessions. I think you are right > that defined() didn't exist then. McCarthy operators are strange. I think that there wasn't an expectation that there would be an evaluation indirection, though you could build one with multiple terenary "?:" expressions. I think the lack of "||" and "&&" mostly had to do with the fact that there was conditional evaluation of the RHS of the operator, based on the result of the LHS. With just an "&" or an "|", you actually need a much less complicated state machine to evaluate a constant expression. With the "||"/"&&", you almost have to do an edge associative operation, which implies a much more complex state machine for the preprocessor, I think. So my guess as to why it's now supported is that the cpp we use today is actually derived from the compiler code itself (and in many compilers, like MSVC++, it's integrated into the compiler completely, and only available seperately as an afterthought)... it being supported is more or less a side effect. In any case, ACE has to be a lot more protable than, say, "ls". Though I'd personally like "ls" to be portable enough that every UNIX just compiled up the FreeBSD version of its own (the best way to establish a standard -- see TCP), it's OK for FreeBSD specific code to be less portable than code ported to FreeBSD. ...now if we only knew what "_POSIX_VERSION > mumble" needed for "mumble"... 8-). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message