Question about name equivalence

Suppose I have:

int a;
int b;

Are variables aalso bequivalent to names (more precisely, since primitive types do not have type names, can they be considered equivalent names)?

Thank.

+3
source share
3 answers

( , ) , , ( ) - , a b , "int". , , , . , . a b , ( "int" ). , " ", - int - . int a; int b; int a, b; - a b ( ) .

C ... , int * short* , int short , struct foo { int x; } struct bar { int x; } - .

+6

, , , :

int a;
int b;

a b .

, :

int a, b;

a b .

0

, C . , C ; . , , , , . .

, , , . , int * char[10]. , " ". C , , , typedef.

C ... , int * short * , int * int * . struct foo { int x; } struct bar { int x; } , , . struct foo * struct foo * , . , , struct . , C.

, . C . ( , , http://www.csd.uwo.ca/~moreno//CS447/Lectures/TypeChecking.html/node3.html) . , , .

:

int x;
int y;

x y, . :

int *x;
int *y;

x y , . :

int *x, *y;

xand are ynot considered equivalent in the lower case name equivalence scheme, as this declaration is considered simply a reduction of the previous declaration. Ada is a well-known language using a strict equivalent name.

0
source

All Articles