New terms for beginners in C ++?

What does this mean by POD type? cv-qual? In the meantime, there is no need to know about it. โ€

+1


source to share


4 answers


A very good article on POD



+1


source


POD, plain old data, any C ++ type that has a C equivalent.

cv-qual type is a type that has been qualified as const or volatile.

// non cv_qualified
int one; 
char *two; 

// cv-qualified 
const int three; 
volatile char * four; 

      



Data elements of POD type must be public and can have any primitive types: bool, numeric types, enumeration types, data pointer types, a function pointer type, as well as arrays of any of the previous ones.

struct A //POD
{
 int n;
 double y;
};

struct B //non-POD
{
private:
 int n;
 double y;
};

      

+8


source


POD stands for Plain Old Data type . This usually refers to the class that is used to store data and accessories - nothing else. It also implies that the function does not have a vtable, which means that there are no polymorphic class members. They are popular for lightweight objects where you don't want to pay the price of the overhead of a polymorphic class.

CV-qualified . C = Const, V = Volatile .

+5


source


what kind of things in C ++ creates a C ++ type not equivalent to c-rajKumar

As CMS said, the POD type is a C ++ type that has an equivalent in C: so it must follow the same rules that C uses for:

  • initialization
  • copying
  • location
  • decision

A C ++ type must not have a constructor, must not overload the assignment operator, must not have virtual functions, base classes, a destructor, and non-static members that are private or protected.

0


source







All Articles