A structure/union/enum name is ALSO a type so no need to typedef structures/unions/enums. This means that the following is possible:
Code: Select all
struct my_struct_type = {
my_struct_type *ptr;
};
my_struct_type my_var;
- Making a typedef of a struct, union or enum creates a derived type (related).
Enhancements
- It is possible to extend structures/unions using the new extends keyword, the two types are related:
Code: Select all
struct my_struct_type extends ancestor_struct_type {
...
}
Fields are appended to the fields of the parent struct/union.
- Anonymous structures/unions are allowed.
- Empty structures are allowed.
- The size of an empty structure is zero.
- Structures fields can be qualified as "packed", in this case there will be no alignment enforcement for the field and the compiler will take care of loading/storing unaligned data.
- It is not possible to take pointers to packed fields.
- Packed is an attribute of fields not structures, structures are aligned normally unless are packed fields of other structures.
- It is not possible to take pointers to packed fields.
Giovanni