
Le 13/11/12 22:39, Boris Schaeling a écrit :
On Thu, 08 Nov 2012 01:08:21 +0100, Alexander Lamaison <awl03@doc.ic.ac.uk> wrote:
[...]Does this mean child *is* copyable on other platforms? So the class has entirely different semantics on different platforms?
Yes. It doesn't own resources on POSIX.
I understand what you hint at. I'm not sure though whether we can justify making child non-copyable for POSIX developers just because Windows developers can't copy it. Uniformity is better. The native_handle could be copyable and this could be platform specific. This make evident that the code is platform specific as the type is platform specific.
Maybe you could also provide a child::id class that is copyable as e.g. std/boost::thread does.
[...]I still don't get why you're letting this behaviour vary between platform. Sure, the underlying system calls have different defaults but they are both capable of both behaviours. The whole point of a platform-independent library is to align such variation.
If you use inherit_env(), you get the cross-platform behavior you are looking for. But I prefer not to break the "pay for what you use"-principle if you don't use inherit_env(). Besides, standardizing the default behavior requires you to pick one. But whether this should be always POSIX, always Windows, always the most convenient or always the easiest to implement - I'm afraid there will be always others who want another default behavior.
One alternative is to make it inherit by default, so that a common behavior is ensured. Then you can provide a platform specific constructor on the platform allowing to don't inherit the environment. Best, Vicente