Re: [patch] const_cast to be replaced by str_unconst

2005-04-14 Thread Oswald Buddenhagen
On Tue, Apr 12, 2005 at 08:28:50PM +0200, Roland Illig wrote: Pavel Tsekov wrote: For those of you that are concerned about the performance loss of an extra function call: It is much more important for the code to be readable and checkable by the compiler than to be 1 millisecond faster at

Re: [patch] const_cast to be replaced by str_unconst

2005-04-14 Thread Roland Illig
Oswald Buddenhagen wrote: whoops, this is exactly what you're talking about. :} anyway, i don't think this extra warning would matter, given that it would be in the same location in every file. and, fwiw, isn't it possible to use a #pragma or some __attribute__ to get rid of the warning? There's a

[patch] const_cast to be replaced by str_unconst

2005-04-12 Thread Roland Illig
Hi all, 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 *). I like this version much more than the

Re: [patch] const_cast to be replaced by str_unconst

2005-04-12 Thread Pavel Tsekov
Hello, On Tue, 12 Apr 2005, Roland Illig wrote: I like this version much more than the const_cast macro I introduced some months ago. Compare these: I mean no offense, but please save us all the I like this, I like that. It's obvious that you check in what you like. For those of you that

Re: [patch] const_cast to be replaced by str_unconst

2005-04-12 Thread Oskar Liljeblad
On Tuesday, April 12, 2005 at 12:27, Roland Illig wrote: Hi! 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,

Re: [patch] const_cast to be replaced by str_unconst

2005-04-12 Thread Roland Illig
Pavel Tsekov wrote: For those of you that are concerned about the performance loss of an extra function call: It is much more important for the code to be readable and checkable by the compiler than to be 1 millisecond faster at all. You can inline it. When compiling with gcc using -Wcast-qual,

Re: [patch] const_cast to be replaced by str_unconst

2005-04-12 Thread Roland Illig
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

Re: [patch] const_cast to be replaced by str_unconst

2005-04-12 Thread Oskar Liljeblad
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,