[Top][All Lists]

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

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

From: Daiki Ueno
Subject: Re: [bug-gettext] [Patch 1/2] Libasprintf bug fixes
Date: Mon, 04 Mar 2013 23:07:26 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Miguel Ángel <address@hidden> writes:

> 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.

But in most cases we need the copy constructor call, no?  I've just
searched on the Web and several pages says that the self-assignment
guard can be eliminated when the copy-and-swap idiom is used.  Seems not
a big deal though.

>> 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.

Okay, then your patch looks good to me.  Do you want me to install it
with "(tiny change)" mark or will you do that after your copyright
status becomes clear?

>> Sorry for grumbling, but I like simplicity.  At least, "autosprintf::"
>> prefix can be removed from your patch.
> In .cc file?

Sorry, I mistook that the change was for .h file.

Daiki Ueno

reply via email to

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