From owner-freebsd-standards@FreeBSD.ORG Tue Mar 11 17:30:58 2014 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EF891D67 for ; Tue, 11 Mar 2014 17:30:58 +0000 (UTC) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id B3BED1C1 for ; Tue, 11 Mar 2014 17:30:58 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 347AC781E9A; Wed, 12 Mar 2014 04:30:56 +1100 (EST) Date: Wed, 12 Mar 2014 04:30:55 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Peter Pentchev Subject: Re: standards/187378: stdlib.h doesn't define W* macros (e.g. WEXITSTATUS) In-Reply-To: <201403111640.s2BGe1J9031029@freefall.freebsd.org> Message-ID: <20140312035904.L898@besplex.bde.org> References: <201403111640.s2BGe1J9031029@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=PqKqMW83 c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=ByQfNe_rhZcA:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=uZvujYp8AAAA:8 a=JCwHtQ7qWEg1GrNU1p4A:9 a=D0mDy0fUJgJ3YimM:21 a=CjuIK1q_8ugA:10 a=WQLKnJ1XLdQA:10 Cc: freebsd-standards@freebsd.org X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Mar 2014 17:30:59 -0000 On Tue, 11 Mar 2014, Peter Pentchev wrote: > > >Description: > > As per this document: > >=20 > > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html > >=20 > > stdlib.h should define W* macros like WEXITSTATUS etc. However, it doesn'= > t. > > FWIW, this is even documented in FreeBSD's stdlib.h :) > > /* XXX XSI requires pollution from here. We'd rather not. */ > > Yes, I know this doesn't help you much; I'm just trying to point out > that, well, this is not an accidental omission, but a deliberate design > decision. For the reasons for it you'll have to ask the people who did > it - this particular text seems to have been added by Garrett Wollman > back in 2002, but I think that he was just documenting the status quo > rather than making a decision right there and then. This was a bug in XSI. You can't even use these macros without doing something nonstandard to get a value that they apply too. Unfortunately, the infestation has now spread to POSIX itself -- this is now shaded CX instead of XSI in the above URL. The infestation has also spread to the nested includes. In the 2001 version: 11720 XSI Inclusion of the header may also make visible all symbols from , 11721 , , and . This is now shaded CX. It bug is still a "may", so is not required. Applications cannot depend on it, so they must include for themself if they want to use a function like wait() to get values that the WEXITSTATUS, etc., macros apply to. The POSIX CX and XSI markup is much more readable than the ifdefs in the C source code, even when when it is misrendered by at least text browsers. It allows a sorted linear list of functions, while the C source code is grouped to create XSI and BSD sections that become increasingly unreadable as they grow internal ifdef tangles. The C ifdefs are inherently more complicated since they need version numbers for the standards. glibc uses a differently organization that makes stdlib.h several times larger and more than several times more unreadable. Bruce