4 ms·
Analyzing the json_value struct, I don't get why values, object_keys and length are fields outside the union. I expected something like: struct json_value {
by teo_zero 2y ago
Analyzing the json_value struct, I don't get why values, object_keys and length are fields outside the union. I expected something like:
struct json_value {
enum json_type type;
union {
bool boolean;
char *string;
double number;
struct {
char **keys;
struct json_value *values;
size_t length;
} object;
} value;
};
Of course I would also use anonymous structs and unions to simplify
json->value.object.length
to
json->length