Home

decl

Decl, short for declaration, is a term used in programming and computer science to denote a statement that introduces an identifier and its attributes (such as type or signature) to a program’s scope. A declaration may or may not allocate storage and generally does not provide executable code; it tells the compiler or interpreter that a symbol exists and how it should be used.

In many languages, declarations establish interfaces separate from definitions. For example, in C or C++, the

Other contexts use the concept of declarations in type systems and interface definitions. In TypeScript and

Decl is thus a general shorthand used in code comments, symbol tables, and documentation to refer to

See also: declaration, definition, forward declaration, function prototype, ambient declaration.

line
extern
int
x;
is
a
declaration
of
x,
while
int
x
=
5;
both
declares
and
defines
x
by
providing
storage
and
an
initializer.
Function
prototypes
like
int
add(int
a,
int
b);
declare
the
function’s
name
and
signature
without
implementing
it.
Declarations
are
commonly
placed
in
header
files
to
separate
interface
from
implementation.
other
languages
with
ambient
declarations,
the
keyword
declare
marks
a
declaration
that
describes
the
shape
of
code
defined
elsewhere.
In
Interface
Definition
Languages,
declarations
specify
interfaces,
methods,
and
types
that
implementations
must
follow.
a
declaration
rather
than
a
definition
or
implementation.
The
term
is
not
a
language
itself
but
a
linguistic
tool
for
clarity
in
technical
writing
and
tooling.