[1857] in BarnOwl Developers
Re: [PATCH] Rewrite color name<->number mapping code
daemon@ATHENA.MIT.EDU (Karl Ramm)
Thu Oct 29 18:23:19 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@lunatique.mit.edu
From: Karl Ramm <kcr@1ts.org>
To: David A Benjamin <davidben@MIT.EDU>
Cc: barnowl-dev@MIT.EDU
Date: Sat, 24 Oct 2009 14:47:59 -0400
In-Reply-To: <alpine.DEB.1.10.0910241409320.5476@dr-wily.mit.edu> (David
A. Benjamin's message of "Sat, 24 Oct 2009 14:19:57 -0400 (EDT)")
David A Benjamin <davidben@MIT.EDU> writes:
> On Sat, 24 Oct 2009, Karl Ramm wrote:
>
>> +static const struct {
>> + const int number;
>> + const char *name;
>> +} color_map[] = {
>> + {OWL_COLOR_INVALID, "invalid"},
>> + {OWL_COLOR_DEFAULT, "default"},
>> + {OWL_COLOR_BLACK, "black"},
>> + {OWL_COLOR_RED, "red"},
>> + {OWL_COLOR_GREEN, "green"},
>> + {OWL_COLOR_YELLOW,"yellow"},
>> + {OWL_COLOR_BLUE, "blue"},
>> + {OWL_COLOR_MAGENTA, "magenta"},
>> + {OWL_COLOR_CYAN, "cyan"},
>> + {OWL_COLOR_WHITE, "white"},
>> + {0, NULL}
>> +};
>>
>
> Would C99 initializers (are we using them in barnowl?) work better
> here? The code below seems to assume that that the elements are in
> order which is not immediately obvious looking at the code.
There should probably be a comment to that effect, but yes, the order is
important. Does the gcc that we're using on solaris support them?
kcr