Is there a way to enforce explicit cast for typedefs of the same type? I\'ve to deal with utf8 and sometimes I get confused with the indices for the character count and the
You could do something like:
typedef struct { unsigned int c_idx; } char_idx; typedef struct { unsigned int b_idx; } byte_idx;
Then you would see when you are using each:
char_idx a; byte_idx b; b.b_idx = a.c_idx;
Now it is more clear that they are different types but would still compile.