Comment 120 for bug 1142213

Revision history for this message
In , Ruslan (b7-10110111) wrote :

> yes the initialization of the extra members of std::string on top of the const char* (which is kept unchanged, passed as a pointer).
It's copied in fact. You thus have first copy - a string literal, and second one - created in constructor. That's why my objection. Even though I recognize that command line is negligible in size, this way of handling string literals is just unclean.
And you don't need to worry about deletion since you can use std::string in caller and then pass it like mycmd.c_str() to runCommand().
In general, I do agree about using self-deallocating objects, but this case doesn't really look like the one which really needs this.

Anyway, if you still aren't convinced, then I won't argue anymore and will agree to have it left alone.