Menu

#5 use std::string everywhere

open
nobody
None
5
2003-08-03
2003-08-03
No

In SolarCell I made the mistake of using const char *
in some methods, where I could have used std::string,
saved myself a lot of bother and only dealt with C
strings at the very end of the chain of method calls,
i.e. when the string data actually enters a GTK+
function for example, where I HAVE NO CHOICE but to
supply a C string.

At the moment, I've prematurely optimised many methods
with const char * parameters or char * return values, I
shouldnt have done that, it makes dealing with strings
harder in the long run, I dont care whether char * is
more efficient than std::string, I want clean code
first, fast code second.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB