Replies: 3 comments 6 replies
-
|
I removed it from C3 because it creates very weird corner cases. While it also solves some corner cases, the disadvantages outweigh the advantages in C3. This also means there are no zero sized arrays. |
Beta Was this translation helpful? Give feedback.
-
|
The question should not be should we allow empty structs for which we have not found a use case?, it should be do empty structs pose a problem? ? If they do, then a good fix for the problem is to disallow them. So far the only problem I see with empty structs is C does not allow them, so extra code would be required in the C back-end to generate compilable code. A potential use case is compile time extendable structs and unions: just like you can define extendable enums and arrays, using Similarly, empty |
Beta Was this translation helpful? Give feedback.
-
|
I would rather not have to work around the issue of zero-sized structs. I'm always in favor of keeping things as simple as possible; there are plenty of other features C2 developers can shoot themselves in the foot with... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently C2 allows empty structs:
type Foo struct {}I have found no use of this however, so then i would like to forbid it (since it makes life easier for auto-conversions).
Currently there are some empty structs in library headers, defining empty, opaque structs.
Does anyone else have a use for this?
Beta Was this translation helpful? Give feedback.
All reactions