Irrwahn said:
Technically correct:
'a' is an identifier designating an object of type int.
Jargon (and in this case I think there's no place for confusion):
'a' is a variable of type int.
That was easy ;-). Now for the next round, you first:
What would you call p and *p, respectively?
int main(void)
{
int a = 1;
int *p = &a;
*p = 2;
return 0;
}
To help all people involved in this really boring discussion, here are
some definitions of the C++98 standard:
"A variable is introduced by the declaration of an object. The
variable’s name denotes the object."
"The constructs in a C++ program create, destroy, refer to, access, and
manipulate objects. An object is a region of storage. [Note: A function
is not an object, regardless of whether or not it occupies storage in
the way that objects do. ] An object is created by a definition (3.1),
by a new-expression (5.3.4) or by the implementation (12.2) when needed.
The properties of an object are determined when the object is created.
An object can have a name (clause 3). An object has a storage duration
(3.7) which influences its lifetime (3.8). An object has a type (3.9).
The term object type refers to the type with which the object is created.
Some objects are polymorphic (10.3); the implementation generates
information associated with each such object that makes it possible to
determine that object’s type during program execution. For other
objects, the interpretation of the values found therein is determined by
the type of the expressions (clause 5) used to access them.
Objects can contain other objects, called sub-objects. A sub-object
can be a member sub-object (9.2), a base class sub-object
(clause 10), or an array element. An object that is not a sub-object
of any other object is called a complete object.
For every object x, there is some object called the complete object of
x, determined as follows:
— If x is a complete object, then x is the complete object of x.
— Otherwise, the complete object of x is the complete object of the
(unique) object that contains x.
If a complete object, a data member (9.2), or an array element is of
class type, its type is considered the most derived class, to
distinguish it from the class type of any base class sub-object; an
object of a most derived class type is called a most derived object.
Unless it is a bit-field (9.6), a most derived object shall have a
non-zero size and shall occupy one or more bytes of storage. Base class
sub-objects may have zero size. An object of POD4) type (3.9) shall
occupy contiguous bytes of storage.
[Note: C++ provides a variety of built-in types and several ways of
composing new types from existing types (3.9). ]"
Regards,
Ioannis Vranos