I just had an interview. I was asked what is a \"forward declaration\". I was then asked if they were dangers associated with forward declarations.
I could not answer to
The only danger of forward-declaring something is when you do the forward declaration outside of a header or in a non-shared header, and the signature of the forward declaration differs from the actual signature of whatever being forward-declared. If you do it in extern "C"
, there would be no name mangling to check the signature at link time, so you may end up with undefined behavior when the signatures do not match.