site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thanks, I wrote that man page. 8-). -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Mar 11, 2009, at 7:53 AM, Andrew Gallatin <gallatin@cs.duke.edu> 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_... I think having that information in the man page is helpful. 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. This email sent to site_archiver@lists.apple.com