What is a variable in C ++?

The standard says

The variable is entered by the declaration of the object. A variable name denotes an object.

But what does this definition really mean?

Does the variable indicate a name for the object, i.e. Are variables just a naming mechanism for anonymous objects otherwise? Or is the variable the name itself?

Or is a variable a named object in the sense that each variable is also an object?

Or is the variable just a "proxy" with a name that "delegates" all operations to the real object?

To make things even more confusing, many C ++ books treat variables and objects as synonyms.

How do you feel about this?


About objects citing from a C ++ 0x project:

An entity is a value, an object, a link, a function [...]

Each name denoting an entity is entered by a declaration.

, , , . :)

+6
7

. ,

new int // create one int object
std::string() // create one string object

"foo" 5 (sub-) "int"

int foo[5];

C++ 03, C++ 0x ( C++ 0x, . )

extern int &r;

, .. ?

( ). (3/3 C++ 03) C++ is-a. , sub- - , - , - , , , .

C++ 0x , "", " " ( , ) "[CN10 ] "" ". " ", , ( ).

C++ 1.8

( 3).

, , " ".

+16

- , , , .

+2

?

- ( , , ), . ( -). , , . - "kinda", - .

+1

-

+1

, .

. ? , , , .

- , . , ++. mearly , , .

, :

int x = 5;

, , SP + 0x003.

- :

x = 52;

SP + 0x003 , 52.

, , . , , , .

0

- , , , , , , , , , , -, . , , .

, , , .

0

A variable is a name for an object. You access the object through this named object.

0
source

All Articles