[rfa] Change lbasename() to return ``const char *''

Fergus Henderson fjh@cs.mu.oz.au
Wed Aug 8 05:09:00 GMT 2001


On 07-Aug-2001, Andrew Cagney <ac131313@cygnus.com> wrote:
> The attached patch changes the liberty function lbasename() so that it 
> returns ``const char *''.

Why?  That will lead to the need for casts in the callers.  Why not just
put the cast in lbasename(), like is done for strchr() in the C standard?

lbasename() is const-polymorphic, i.e. the return value should be
a const pointer iff the argument is a const pointer.
C doesn't have any good way to express the type of const-polymorphic routines.
Unless you duplicate the code in two functions, one for const pointers and one
for non-const pointers, some casting will be required.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.



More information about the Binutils mailing list