Date: Sat, 12 Oct 2002 01:44:36 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: Bruce Evans <bde@zeta.org.au> Cc: Craig Rodrigues <rodrigc@attbi.com>, freebsd-standards@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: Problem detecting POSIX symbolic constants Message-ID: <3DA7E0F4.5988CA77@mindspring.com> References: <20021012171803.F15910-100000@gamplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DA7E0F4.5988CA77>