[PATCH] [RFC] Come up with startswith function.

Martin Liška mliska@suse.cz
Thu Mar 18 15:26:20 GMT 2021


On 3/18/21 3:54 PM, Tom Tromey wrote:
>>>>>> "Martin" == Martin Liška <mliska@suse.cz> writes:
> 
> Martin> Is the binutils community interested in the function?
> 
> gdb already has one.

Heh, gdb is always using the cutting edge features, like modern C++.

> Adding one in libiberty is fine with me as long as
> it doesn't cause build failures there.

I considered doing that but it has some drawbacks:
- we want to have the implementation in a header file
- one needs '#include <string.h>'
- or it will have to be a macro, but it will have to use '__extension__ ({...' syntax
   as we won't double evaluation of the PREFIX argument

> 
> gdb's are in gdbsupport/common-utils.h; it is overloaded to handle
> string_view as well.

Nice!

Martin

> 
> Tom
> 



More information about the Binutils mailing list