Re: Use of feature test macros

Mouse <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
> In the system headers, we use this pattern a lot:

>> #if (_POSIX_C_SOURCE - 0 >= 200809L) || defined(_NETBSD_SOURCE)

> Are the parentheses around the first condition really necessary?  If
> so, for which cases?

Probably not...I *think*.

> Is the "- 0" in the first expression really necessary?  If so, for
> which cases?

The case where _POSIX_C_SOURCE is not defined at all.  (Whether that
case is worth bothering with, that's arguable.  But I think that's
probably the point of the -0.)

This is a valid #if:

#if ( - 0 > 200809L) || defined(_NETBSD_SOURCE)

This is not:

#if ( > 200809L) || defined(_NETBSD_SOURCE)

Of course, if _POSIX_C_SOURCE is defined as

	do } case ~ ( ) j -

that won't help.  But in that sort of case nothing will.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		[email protected]
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.