Re: [PATCH v2 31/31] Support an "unlimited" number of user-defined arguments

Pedro Alves
2016-10-19T12:47:36Z

On 10/19/2016 12:33 PM, Philipp Rudo wrote:
> Pedro Alves <palves@redhat.com> wrote:

>> I also needed a way to convert a number to a std::string, so I added a
>> new utility for that, gdb::to_string. Yet another thing that can go
>> away with C++11.
> [... snip ...]
>> +/* Returns a string representation of VAL. Replacement for
>> + std::to_string, which is only available in C++11 or later. */
>> +
>> +namespace gdb {
>> +
>> +template <class T>
>> +inline std::string
>> +to_string (const T &val)
>> +{
>> + std::stringstream ss;
>> +
>> + ss << val;
>> + return ss.str ();
>> +}
>> +
>> +}
>> +
>> /* Make a copy of the string at PTR with LEN characters
>> (and add a null character at the end in the copy).
>> Uses malloc to get the space. Returns the address of the copy. */
>
> Is this really necessary?
> As far as I understood the discussion, we jump directly to C++11. Thus there is no need for an homemade to_string.

We haven't actually officially committed to requiring
C++11, so I didn't want to be blocked by that. It's
trivial to remove that bit latter if this lands first.

On C++11, I was just giving time for the follow ups to
last week's discussion to settle:

https://sourceware.org/ml/gdb-patches/2016-10/msg00497.html
https://sourceware.org/ml/gdb-patches/2016-10/msg00556.html

and give everyone a chance to comment (or re-comment after
consideration).

No one commented on the patches linked to from here either:

https://sourceware.org/ml/gdb-patches/2016-10/msg00497.html

Up until last week I wasn't even thinking that going C++11
would be possible. So I don't want to look like I'm rushing
it. But now it feels like I'm the one delaying .... :-P

Maybe I should just press ahead and be done with it.

Thanks,
Pedro Alves