Re: [patch] const_cast to be replaced by str_unconst



Oskar Liljeblad wrote:
On Tuesday, April 12, 2005 at 12:27, Roland Illig wrote:
I'd like to introduce a new function:

   char *str_unconst(const char *);

The function returns a string that compares equal to its argument, but does not have the "const" qualifier. Currently it just returns its argument, cast to (char *).

In what way is this function (or macro) useful? It seems to break the
whole point with 'const' in C. If something is const, you shouldn't
touch it. Or should you?

We are using SLang and Samba, which both don't know about the "const" qualifier. The function is meant for exactly these cases, which I hope will disappear in the next future. But that's only a dream. :)

in vfs/samba/include/smb.h, line 72, you can find:

    int Debug1 (char *, ...);

in slang/include/slang.h, line 155:

    extern char *SLmemcpy (char *, char *, int);

Roland



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]