[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/language/type [Back]  [Original]

cppreference.com
cppreference.com

cppreference.com

, , , , , , , , , .


C++ :

( C++11)
  • bool;
  • :
  • :
  • : char, signed char, unsigned char[1]
  • char8_t
( C++20)
  • (char16_t, char32_t, ( C++11)wchar_t);
  • :
  • (signed char, short int, int, long int, long long int);
( C++11)
  • :
  • (unsigned char, unsigned short int, unsigned int, unsigned long int, unsigned long long int);
  • ( );
( C++11)
  • (float, double, long double cv- );
( C++23)
  • lvalue ;
  • lvalue ;
  • rvalue ;
  • rvalue ;
( C++11)
( C++11)
  1. signed char unsigned char , . , .

cv- , , cv- , (const, volatile const volatile).

:

, std::size_t (.. sizeof) .

, :

C++ , ; . , T, T , , -- --, , .

int * p;              //    int
static_cast<int*>(); //  ,  "int*"

int a[3];   //    3- int
new int[3]; //  ,  "int[3]" ( new  )

int (*(*x[2])())[3]; //    2-   
                     //      3- int
new (int (*(*[2])())[3]); //  ,  "int (*(*[2])())[3]"

void f(int);                    //  ,  int   void
std::function<void(int)> x = f; //   ,   
                                // "void(int)"
std::function<auto(int) -> void> y = f; //   

std::vector<int> v;       //    int
sizeof(std::vector<int>); //  ,  "std::vector<int>"

struct { int x; } b;         //       b  
sizeof(struct{ int x; });    // :       sizeof
using t = struct { int x; }; //      t,    

sizeof(static int); // :      
                    // --
std::function<inline void(int)> f; // :   

.

:

:

  • ( ), -- -- ( , );
  • , .

(, ) , . .

.

, , . .

glvalue , .

// 
struct B {virtual ~B() {} }; //  
struct D: B {}; //  
D d; //   
B* ptr = &d;
//   (*ptr)  B
//   (*ptr)  D

prvalue , .

:

  • void ( cv-);
  • :
    • , (, ), ;
    • ;
    • ;
    • .

.


, T :

( , T .)

- , . .

:

  • (, class X) - ; class X :
struct X;             //  X,    
extern X* xp;         // xp    :
                      //  X 

void foo()
{
  xp++;               //  : X 
}

struct X { int i; };  //  
X x;                  // OK:  X 

void bar()
{
  xp = &x;            // OK:     X
  xp++;               // OK: X 
}
  • , , ; , ; .
  • , , - ; (" T " " N T") .

. , typedef, . :

extern int arr[];   //  arr 
typedef int UNKA[]; // UNKA  
UNKA* arrp;         // arrp    
UNKA** arrpp;

void foo() {
  arrp++;           // : UNKA  
  arrpp++;          // OK: sizeof UNKA* 
}

int arr[10];        //   arr 

void bar() {
  arrp = &arr;      // :  
  arrp++;           // : UNKA    
}

C++:

CWG 328 C++98 ,

CWG 977 C++98 ,
,
CWG 1362 C++98 T* T&,
T
CWG 2006 C++98 cv- void
CWG 2448 C++98 cv-
cv-
CWG 2630 C++98 ,
,
,
CWG 2643 C++98
( )


Web Proxy Viewer  |  New URL  |  Original Page