2 ms·
> in C you can write a header file which says this is a pointer to T, without ever saying what's in T What you're referring to is a forward declaration. Forwar
by acuozzo 2y ago
> in C you can write a header file which says this is a pointer to T, without ever saying what's in T
What you're referring to is a forward declaration. Forward declarations only work when the definition will be known at some point during compilation.
If you're writing an API header to a binary you're shipping and you don't want to provide the definition to the user of the API, then a forward declaration is no bueno. The compiler needs to know the size, alignment, etc.