Follow-up Comment #1, bug #13807 (project freeciv):

I'm not sure that we need to get rid of the static
'settings' array and use dynamic memory for settings,
since even with your approach there will still be at
least one variable global to the settings.c file.

If you are worried that you cannot use static initializers
with unions, you need not be, since you can use the

union foo {
  int i;
  const char *s;
  bool b;

union foo f1 = { .b = TRUE };
union foo f2 = { .s = "hi" };

This could be a little more tricky though, since the
settings take the address of the int/bool. I think you
can just do

union pfoo {
  int *pi;
  bool *pb;
  char *ps;

union pfoo pf1 = { .pi = &value };

Of course please use much better variable and field
names than I do in the examples.



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to