Follow-up Comment #2, bug #13868 (project freeciv):

'const' flags could be added to the values, like 'bool *const pbval' to be
sure that pointer won't be modified.

I'm not totally conviced by the names.  If you do a struct boolean, you don't
need to have 'b' in every other variables.

You can also using a anonymous union to use directly what is inside.

I would suggest:
union {
  /*** bool part ***/
  struct {
    bool *const pvalue;
    const bool default;
    const bool_validate_func_t validate;
  } boolean;
  /*** int part ***/
    struct {
    int *const pvalue;
    const int default;
    const int min;
    const int max;
    const int_validate_func_t validate;
  } integer;
  /*** string part ***/
  struct {
    char *const value;
    const char *const default;
    const size_t size;
    const string_validate_func_t validate;
  } string;
};

So the bool value would be '*pset->boolean.pvalue' which looks enough clear
for me.


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?13868>

_______________________________________________
  Message posté via/par Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to