This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: char *lbasename(const char *) VS const char *lbasename() ...
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Subject: Re: char *lbasename(const char *) VS const char *lbasename() ...
- From: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Date: Wed, 13 Jun 2001 12:02:16 +0300 (IDT)
- cc: GDB Discussion <gdb at sources dot redhat dot com>
On Tue, 12 Jun 2001, Andrew Cagney wrote:
> libiberty recently added the function:
>
> char *lbasename (const char *name);
>
> with semantics roughly equivalent to:
>
> return (char *) name;
>
> I'm thinking (serious :-) of sending a patch to the maintainers (GCC
> list) asking that it changed to:
>
> const char *lbasename (const char *name);
>
> so that the fact that the string was constant isn't lost across the call
I agree: if the argument is a `const char *', and the return value is
guaranteed to be within the argument string, it should also be `const
char *'.