wc-duck / datalibrary

Open Source Data Library for data serialization.
Other
42 stars 8 forks source link

Enums as members does not compile in c #24

Closed lundmark closed 8 years ago

lundmark commented 8 years ago
{
    "module" : "stuff",
    "enums" : {
        "my_enum" : {
            "THIS_IS_ENUM" : 0
        }
    },
    "types" : {
        "my_thing" : {
            "members" : [ 
                { "name" : "this_is_it", "type" : "my_enum" }
            ]
        }
    }
}

generates a struct that looks like this:

struct my_thing
{
    my_enum this_is_it;
};

Which unfortunately does not compile in c. I assume that the same thing happens when you do the same thing with structs. I'd suggest either adding the "enum" / "struct" keyword to the types (preferably) or do the c-style of declaration with typedef enum my_enum {} my_enum;

lundmark commented 8 years ago

This will be solved by https://github.com/wc-duck/datalibrary/pull/25

wc-duck commented 8 years ago

I really need to get some c-compile tests going... I'll check your pr right away.

wc-duck commented 8 years ago

Merged.