void System::daemonize(const string &dir = "/", const std::string &stdinfile = "/dev/null", const std::string &stdoutfile = "/dev/null", const std::string &stderrfile = "/dev/null")
I assume you are referring to the function header in the code, referenced above. As this code is intended for C++ usage (but can easily be converted to C) I used the very common "const reference" in C++, which is a normal optimization technique.
By using the const reference we are getting the performance of passing by reference (as opposed to passing by copy) combined with the guarantee (const) that the user of the function may not modify the parameters.
This technique is not considered to be "premature optimization," it falls more into the category of "best practices."
Recent comments
2 hours 39 min ago
2 hours 40 min ago
12 hours 53 min ago
14 hours 21 min ago
14 hours 21 min ago
14 hours 21 min ago
21 hours 38 min ago
2 weeks 3 days ago
4 weeks 4 days ago
4 weeks 4 days ago