[patch] const_cast to be replaced by str_unconst

Oskar Liljeblad oskar at osk.mine.nu
Tue Apr 12 18:49:57 UTC 2005


On Tuesday, April 12, 2005 at 20:16, Roland Illig wrote:
> >>   char *str_unconst(const 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);

Ah I see. I've come across that problem in other libraries as well
(libupnp for another application). If it only was easy to fix the
source of the problem (the function prototypes in those libraries!),
but unfortunately it isn't always...

Regards,

Oskar Liljeblad (oskar at osk.mine.nu)



More information about the mc-devel mailing list