I am wondering why the TString::Itoa method does not have a default base argument. It should have a default argument for base 10, since that is what I imagine is most commonly desired. Several times I have had to search the docs to to find out that I had to explicitly specify base 10.
It doesn’t help that the CINT error message is not useful when one forgets the explicit base:
[code]* ROOT v5.34/10 *
root [0] TString::Itoa(10)
Error: Function Itoa(10) is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***
[/code]
I am sometimes reminded if my guess is that the Itoa method is for some reason non-static and I need to construct a real TString before using its Itoa:
root [1] TString s
root [2] s.Itoa(10)
Error: Can't call TString::Itoa(10) in current scope (tmpfile):1:
Possible candidates are...
public: static TString TString::Itoa(Int_t value,Int_t base); //Converts int to string with respect to the base specified (2-36)
*** Interpreter error recovered ***
Is there any reason not to add a default base of 10 to the Itoa & related methods (LLtoa, UItoa, etc)? At the very least, using the static class method TString::Itoa incorrectly should give the same helpful error message as using an existing TString’s Itoa method.
Jean-François