K
Keith Thompson
Joshua Maurice said:Well, actually, as Keith pointed out, you "define" typedef names. Â That's
the language the standard uses.
Could you quote please? Sadly, I do not have a C standard copy handy.
From what I can read from the C++03 standard, it never refers to
defining a name.
C++03, 7.1.3 The typedef specifier / 1
Declarations containing the decl-specifier typedef declare identifiers
that can be used later for naming fundamental (3.9.1) or compound
(3.9.2) types.
I would assume that C is the same in this regard. You declare names,
you define objects, functions, types, etc.
It's probably not a great idea to assume that C and C++ are consistent
in the finer points of terminology.
C99 6.7p5:
A declaration specifies the interpretation and attributes of a set
of identifiers. A definition of an identifier is a declaration for
that identifier that:
-- for an object, causes storage to be reserved for that object;
-- for a function, includes the function body;
-- for an enumeration constant or typedef name, is the (only)
declaration of the identifier.
An assumption that's been unstated so far in this thread is that
something is "defined" if and only if there's a "definition" for it.
I'm not entirely sure that's a safe assumption. It implies, for
example, that a struct type cannot be "defined", which is at least
odd.
BTW, if you want a copy of the C standard,
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf>
is almost certainly good enough for your purposes.