C
Christoph Bartoschek
Hi,
the following code does not work:
class A;
class B {};
typdef B A;
Is there a deep reason why this should not work? Why not allowing the
typedef to resolve the forward declaration as long as the sources match and
as long as the ODR is followed?
A follow-up quesition is: Why is there no way to forward-declare a generic
object type that is later defined to an object type?
With such a forward declaration one could already use pointers till the type
is bound to an object type. Given this one were not forced to use
reinterpret_cast or lots of code in such a situation.
The only reason I can think of is that one would have to extend the linkers
to cope with forward-declarations.
Christoph
the following code does not work:
class A;
class B {};
typdef B A;
Is there a deep reason why this should not work? Why not allowing the
typedef to resolve the forward declaration as long as the sources match and
as long as the ODR is followed?
A follow-up quesition is: Why is there no way to forward-declare a generic
object type that is later defined to an object type?
With such a forward declaration one could already use pointers till the type
is bound to an object type. Given this one were not forced to use
reinterpret_cast or lots of code in such a situation.
The only reason I can think of is that one would have to extend the linkers
to cope with forward-declarations.
Christoph