what's the use of empty structs in C-style languages ?

Basile B. b2.temp at gmx.com
Mon Dec 2 17:03:22 UTC 2024


I've noticed that empty struct are always at least a size of 1, 
see [D explorer](https://godbolt.org/z/sGYcex4cf). There you can 
see `%example.S = type { [1 x i8] }`

So te compiler inserts a dummy member so that that everything can 
work as usual.

Big question is what is the problem if we specify that empty 
struct is an error ?


More information about the Digitalmars-d-learn mailing list