* char *lbasename(const char *) VS const char *lbasename() ...
@ 2001-06-12 12:47 Andrew Cagney
2001-06-13 2:01 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cagney @ 2001-06-12 12:47 UTC (permalink / raw)
To: GDB Discussion
Hello,
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
(If you're wondering, GDB will (once I've committed a recently posted
patch) compile with -Werror against either function).
Does anyone have any thoughts or suggestions before I try and do this :-)
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: char *lbasename(const char *) VS const char *lbasename() ...
2001-06-12 12:47 char *lbasename(const char *) VS const char *lbasename() Andrew Cagney
@ 2001-06-13 2:01 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2001-06-13 2:01 UTC (permalink / raw)
To: Andrew Cagney; +Cc: GDB Discussion
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 *'.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-06-13 2:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-12 12:47 char *lbasename(const char *) VS const char *lbasename() Andrew Cagney
2001-06-13 2:01 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox