I'd like to have something functionally equivalent to, say,
void make_it_happen(void)
{
struct T t;
for(start(&t); !done(&t); doit(&t));
}
The function has no business knowing what's inside struct T; it just
provides a "holder". Ideally, I'd say e.g.
struct T;
to pass an incomplete type, but that's not enough for instantiation of t.
A dynamic-memory-allocation-inspired scheme like
void make_it_happen(void)
{
struct T *p = start_newT();
for(; !done(p); doit(p));
free(p);
}
is not an option on a small (embedded) target, not to mention the overhead.
Is there a clever way not to drag around the complete definition of
struct T but still be able to create a holder and point to it as to
struct T* ?
Likewise, is there a clever compile-time constant equivalent to
sizeof(struct T), all without exposing complete definition.
[I suspect both are silly questions, but I'd take my chances.]
Thank you,
--
Ark