bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] [Patch 1/2] Libasprintf bug fixes


From: Miguel Ángel
Subject: Re: [bug-gettext] [Patch 1/2] Libasprintf bug fixes
Date: Mon, 04 Mar 2013 14:38:58 +0100

Daiki Ueno <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]