Re: posix_spawn man page strangeness
Re: posix_spawn man page strangeness
- Subject: Re: posix_spawn man page strangeness
- From: Terry Lambert <email@hidden>
- Date: Wed, 11 Mar 2009 10:48:35 -0700
On Mar 11, 2009, at 7:53 AM, Andrew Gallatin <email@hidden>
wrote:
Stéphane Sudre wrote:
Is it a bug that the __restrict option is written behind the name
of every parameters of the posix_spawn and posix_spawnp prototypes
in the man page?
It might be better readable without the "restrict" word.
"restrict" is a C99 keyword that specifies that the referenced
pointers
to the function must not be aliased (point to the same memory
location).
This enables additional compiler optimizations. See
http://www.cellperformance.com/mike_acton/2006/05/demystifying_the_restrict_keyw.html
I think having that information in the man page is helpful.
Thanks, I wrote that man page. 8-).
It's also required by the POSIX standard that it be there. At the
time, gcc could not actually implement it interior to array subscripts
because gcc failed to fully comply with the c99 standard, which is one
of the reasons we left the feature test for posix_spawn turned off in
<unistd.h> (the code could not pass conformance testing with gcc as
the c99 compiler).
From a technical point of view, I am really torn, since it's more or
less the rebirth of noalias.
DMR himself railed against noalias in defense of a posting by me
hating the idea, and being piled onto in comp.lang.c by members of the
X3J11 committee, which I have to admit was a pretty proud moment for
me (google for the quoted phrase "noalias must go. This is non-
negotiable."). On the other hand, in this very particular case, it
lets us write an API in libc that can change its contract between user
and kernel space without losing any binary compatibility, since all
the data parameters are properly encapsulated by init/accessor/mutator/
destroy functions.
The function is also odd in that it's the only one which directly
returns its errno as its return value, another API design I happen to
agree with wholeheartedly, but which it's far to late to retrofit
everywhere, which leaves posix_spawn() the very odd man out.
Either way, it's ruled by a standard which means strict conformance
means improved source code portability for developers, so it's not
going to change unless the change is mandated by The Austin Group and
then documented by The Open Group.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden