On Tue, Aug 28, 2007 at 03:12:25PM +0100, seventh guardian wrote: > On 8/28/07, Dominik Vogt <[EMAIL PROTECTED]> wrote: > > > Hum but now gcc complains about the const char * vs. char *: > > > > > > (...) > > > cc1: warnings being treated as errors > > > Flocale.c: In function 'FlocaleGetFftFont': > > > Flocale.c:1079: warning: assignment discards qualifiers from pointer > > > target type > > > > I guess we have to remove the "const" then. That's better than > > casting it away every time. > > Too late, I've already casted them ;) > > I guess it's better to leave it a const, as it could allow the > compiler to optimize it. But I can change it back and remove the > const.. What do you think?
Both solutions are equally dirty. I prefer not using const very
slightly:
pro
* The declaration does not suggest something that is not true.
* There are fewer places to change.
const
* If fvwm ever tries to change the string, it probably crashes
(which is at least well defined behaviour).
* The compiler might optimize the code less efficiently
(unlikely but possible).
A clean but weird solution would be to declare a struct:
struct
{
const char *const_string;
char *var_string;
}
But I am interested in other opinions.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt, dominik.vogt (at) gmx.de
signature.asc
Description: Digital signature
