From owner-freebsd-hackers Thu Oct 10 12:33:35 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 14F2D37B401; Thu, 10 Oct 2002 12:33:34 -0700 (PDT) Received: from conure.mail.pas.earthlink.net (conure.mail.pas.earthlink.net [207.217.120.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id A638C43E97; Thu, 10 Oct 2002 12:33:33 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0397.cvx21-bradley.dialup.earthlink.net ([209.179.193.142] helo=mindspring.com) by conure.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17zj3k-00034J-00; Thu, 10 Oct 2002 12:33:25 -0700 Message-ID: <3DA5D5BD.1DAFF031@mindspring.com> Date: Thu, 10 Oct 2002 12:32:13 -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: <20021010205529.M8598-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: > In Standard C, this is equivalent to the non-verbose version: > > #if _POSIX_REALTIME_SIGNALS != -1 > ... > #endif > > since if _POSIX_REALTIME_SIGNALS is not defined then it is equivalent to > 0 in cpp expressions. The problem cases are if _POSIX_REALTIME_SIGNALS > is defined to or , but these are not permitted in > POSIX.1-2001. These cases were permitted for many feature test macros > in POSIX.1-1990. I know it's not fashionable to write code that's portable to compilers other than GCC, but even if FreeBSD is going to ignore portability for it's own source code, it's probably unreasonable to expect ACE to ignore portability for theirs. > > Sigh. Why did the POSIX guys do this? :( > > Perhaps because they wanted you to use sysconf() instead of these mistakes. > Actually, they didn't do this. _POSIX_REALTIME_SIGNALS is specified to > have value 0, -1 or 200xxxL (draft 7 says xxx; I think the final standard > says 112). This can't be the case; specifically, the sysconf() test will only work at runtime, which means that the symbols had to be there and resolvable at link time. Unless you know some preprocessor directive to access the "sysconf" space? > > BTW, I think that: > > #if defined(_POSIX_REALTIME_SIGNALS) && (_POSIX_REALTIME_SIGNALS != -1 ) > > > > should suffice, but I'll double-check with one of my portability gurus > > to see if that is OK for ACE. > > This is variant of the above verbose version. It requires slightly more > modern compilers, so it might fail for some 20-year old pre-Standard C > compilers instead of only for some 25-year old ones. Uh, the 1990 standard, which allowed "#if" is only 12 years old. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message