Daiki Ueno <[email protected]> writes: > autosprintf& operator = (autosprintf src)
This imply the copy constructor when calling. Also It is not the C++ convention and It does not optimize self assignment. > or just providing autosprintf::swap instead of the assignment operator? Assignment operator is always present for C compatibility. You can assign a struct to another of the same type, and it will copy its contents (including pointers). That is why this operator is implicit at each class declaration. But our pointer will be free()'ed twice when the second destructor of a copied object is called. Also assignment can be forbid declaring it private, but it is not an ABI change, It is an API one. > Sorry for grumbling, but I like simplicity. At least, "autosprintf::" > prefix can be removed from your patch. In .cc file? Sure, but it is not the same function. I mean, from a C point of view, after name mangling autosprintf::operator= has a function name, the one of global operator= (without the autosprintf:: and outside of class definition) is different. Best regards, Miguel
