In a previous question I asked, I found out I had to use an enum for whatever reason to define my values in the following source code:
enum { key0_buffer = 0};
void process_tuple(Tuple *t)
{
//Get key
int key = t->key;
//Get integer value, if present
int value = t->value->int32;
//Decide what to do
switch(key) {
case key_0:
enum {key0_buffer = value};
break;
};
}
...
static WeatherAppDataPoint s_data_points[] =
{
{
...
.high = key0_buffer,
},
};
In this code, meant to run on the Pebble Watch(cloud pebble.com), value comes from a separate JS app running on a phone and then receives that value. However, as seen here I want to turn that integer into an enumerator(reason is here: initializer element not constant?). The code spits the following errors:
../src/app_data.c:120:5: error: a label can only be part of a statement and a declaration is not a statement
../src/app_data.c:120:11: error: enumerator value for 'key0_buffer' is not an integer constant
../src/app_data.c:109:9: error: variable 'value' set but not used [-Werror=unused-but-set-variable]
How can I convert an integer into an enumerator?