I always find it a bit unfair when I see sloppy C programs used
for shock value. What if the Rust developer uses fork().unwrap_or(default_value) in a hurry,
or writes<p><pre><code> if let Some(child) = fork() {
do_only_child_stuff();
} else {
do_only_parent_stuff();
}
</code></pre>
or<p><pre><code> if let Some(ForkResult::Child) = fork() {
do_only_child_stuff();
} else {
do_only_parent_stuff();
}
</code></pre>
Now, if you're about to tell me that the examples above are totally stupid and no
developer would do such a thing, then you know how I feel about the sloppy
C versions. Doing a system call and not checking for error is totally
stupid as well.<p>By the way, you can also write your own wrapper functions in C,
that transform the return value into something like<p><pre><code> struct fork_status {
enum { ERROR, PARENT, CHILD } state;
int ret;
};
</code></pre>
Then Clang and GCC will warn you about missing switch cases.<p>That said, the libc bindings in Rust are pretty low-level and a project that
offers higher-level wrappers can be very helpful, so I hope my comment doesn't
create the impression that I'm ripping on the project itself.