Comment 118 for bug 1142213

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

> So now: using size *=2, rather than incrementing linearly the size is known to be more efficient algorithmically.
Yeah, surely, but with chunks of 512 bytes this isn't gonna increase much more than to 2KiB, so this inefficiency can be neglected in favor of cleaner code.

> There is No conversion from const char* to std::string in the current code
> the call runCommand( "..." ) implicitely calls the std::string directly
> as for the call string.c_str() it access directly the const char* stored internally in the string
Why no conversion? You call runCommand("str") and this calls std::string("str") potentially doing some initialization there. And then you call a function which needs const char*, in which case although you don't convert, but this still is redundant.

> All in all, that's the whole idea behind using c++ instead of c, and limit c to where you have
> to (namely when calling gtk, glib or other functions).
Yeah I do understand this, but you have a POSIX function here - this is just like gtk function, and we pass string literal here, for which std::string has no advantage at all.