Re: Symbol Name Length (Was: STL Memory leak?)
On Apr 9, 11:21 am, Arne Mertz <n...@arne-mertz.de> wrote:
James Kanze schrieb:
char *strcpy(char *source, char *dest)
{
char *ret = source;
while ((*dest = *source) != 0)
{
++dest;
++source;
}
return ret;
}
[snip]
And of course, I notice that you've adopted a convention for
abbreviating names as well: why not sourceString and
destinationString? (Objects should be qualified nouns, and
abbreviations aren't used, according to the usual naming rules.)
Well, abbreviations could be omitted, but I think source and
destination would be enough. Encoding the variable's type in
the name often is no good idea. First, you can see the types
from the function's parameter declaration. Second, in a more
general case, consider this:
std::list<std::string> optionList;
after some refactoring this is changed to
std::vector<std::string> optionList; //oops.
Encoding the type in the variable's name is duplication of the
type information (and therefore violates the DRY principle),
and it can (and eventually will) lead to misinformation if the
type changes as shown above.
But your example doesn't contain an instance of the type in
name. The object is a list of options; whether the list is
implemented using std::list or std::vector doesn't change that.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34