This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 7/8] Use unique_xmalloc_ptr in execute_gdb_command


On 11/29/2016 05:05 AM, Tom Tromey wrote:
> This replaces a cleanup in execute_gdb_command with an instance of
> unique_xmalloc_ptr.  std::string was not used because execute_command
> and execute_command_to_string don't accept a "const char *" (in fact
> the reason for copying the string at all).

You can do:

 std::string copy (arg);
 ...
 to_string_res = execute_command_to_string (&copy[0], from_tty);

That's fine in C++11.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]