-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decide consensus on styling for recursive/"references each other" structs AND styling for unions. #212
Comments
sometimes it is necessary to have the typedef and struct definition separately, usually when the structs contain pointers to eachother, in that case the de facto standard is the following Struct1.h
Struct2.h
ofc what struct contains the typedef is somewhat arbritrary, but it's usually based on which one is "higher level" or "more specific" |
as for unions, imo they should follow the same rules as structs |
I already mentioned this in point 5 |
I think the issue with unions is that knowing that it's a union is very useful context, because the way that you operate on unions is much differently than structs. One possibility is that they follow the same rules as structs, but have to be suffixed with |
generally I don't think you should really be passing unions around by themselves, all unions should be within a struct, even if it is the only thing in the struct imo |
Is that really possible to enforce while matching? |
I think so? not sure metrowerks makes that much of a distinction, if it's not actually possible then imo it should be explicit in the type name |
|
I have realized that labelling all unions with a Union suffix may not be the right choice. Consider this union for example. typedef union Quaternion_AsMtxF44 {
struct {
f32 _00, _01, _02, _03;
f32 _10, _11, _12, _13;
f32 _20, _21, _22, _23;
f32 _30, _31, _32, _33;
};
f32 m[4][4];
f32 a[16];
} Quaternion_AsMtxF44; This is literally just an |
This issue has had no activity for 60 days and will be marked stale. If there is no further activity, it will be closed in 30 days. |
5. There is no consensus for defining recursive structs.
When defining a recursive struct, the struct must be declared and defined. Below are the options for declaring the struct.
Below are the options for defining the struct. Option A1 is only compatible with Option B1. Keywords/identifiers in
<>
are optional.6. There is no consensus on whether unions should follow the same rule as structs.
The text was updated successfully, but these errors were encountered: