Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Re: client option change callback (PR#1935)
Home

[Freeciv-Dev] Re: client option change callback (PR#1935)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: client option change callback (PR#1935)
From: "baumans" <baumans@xxxxxxxxxxxxx>
Date: Sat, 2 Nov 2002 10:45:14 -0500

----- Original Message -----
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
To: <freeciv-dev@xxxxxxxxxxx>
Sent: Saturday, November 02, 2002 10:08 AM
Subject: [Freeciv-Dev] Re: client option change callback (PR#1935)


> On Sat, 17 Aug 2002, Jason Short wrote:
> > I've also changed the struct initializers to the "new" (C99?) format,
> > which is far more readible IMO. Feel free to change the indentation as
> > you like...
>
> I want a decision on this. Is this C99 behaviour portable and acceptable
> style?
>
> ie
>
> +#define GEN_INT_OPTION(oname, desc) \
> +  { name: #oname,                   \
> +    description: desc,              \
> +    type: COT_INT,                  \
> +    p_int_value: &oname,            \
> +    p_bool_value: NULL,             \
> +    p_string_value: NULL,           \
> +    string_length: 0,               \
> +    change_callback: NULL,          \
> +    p_string_vals: NULL,            \
> +    p_gui_data: NULL                \
> +  }
That's actually GCC style.
This is C99 style:
 +#define GEN_INT_OPTION(oname, desc) \
 +  { .name = #oname,                   \
 +    .description = desc,              \
 +    .type = COT_INT,                  \
 +    .p_int_value = &oname,            \
 +    .p_bool_value = NULL,             \
 +    .p_string_value = NULL,           \
 +    .string_length = 0,               \
 +    .change_callback = NULL,          \
 +    .p_string_vals = NULL,            \
 +    .p_gui_data = NULL                \
 +  }

This should be more portable, but I don't know.  As a note, you don't
actually have to declare all the NULLs.
>
>   - Per
>
>
>



[Prev in Thread] Current Thread [Next in Thread]