tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Use of feature test macros



> 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		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index