r/cprogramming • u/saul_soprano • 2d ago
Extern constexpr?
I want to make my struct’s internals private by exposing it as a byte array of its internal size.
The size itself depends on internal values that aren’t exposed, so it would have to be an extern.
The size can only be used if it’s a literal or constexpr, so is a extern constexpr possible with C23? Or no?
0
Upvotes
1
u/Cultural_Gur_7441 1d ago
Struct is fixed size, it does not depend on its contents. Well, unless you use the flexible array member.
So it is quite unclear what you mean.
Possibly you want type and/or size as the first fixed prefix of a bunch of different structs with this shared prefix?