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

Re: [patch] const_cast to be replaced by str_unconst

2005-04-14 Thread Oswald Buddenhagen
On Thu, Apr 14, 2005 at 07:19:28PM +0200, Oswald Buddenhagen wrote: > On Tue, Apr 12, 2005 at 08:28:50PM +0200, Roland Illig wrote: > > >You can inline it. > > > > When compiling with gcc using -Wcast-qual, this would give us a warning > > for every file. > > > ??? > put > static inline unconst**

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 fast

Re: [patch] const_cast to be replaced by str_unconst

2005-04-13 Thread Roland Illig
I have just committed str_unconst(). I will slowly replace the uses of const_cast by str_unconst(). Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel

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 a

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 argum

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, thi

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 > argum

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

[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 const_ca