Skip to content
Latchkey

What Is a Forward Declaration?

A forward declaration introduces the name and basic shape of a type or function so it can be referenced before the compiler sees its complete definition. It is enough for uses that only need a pointer or a signature, not the full layout. The complete definition must still appear before code that requires the type details.

Why it matters

Forward declarations break include cycles and cut compile dependencies, which can speed up builds and reduce coupling. They also enable mutually referencing types that could not otherwise be defined.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →