Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: All
Jan 18, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Understanding Zero Initialization

To zero-initialize an object of type T means that the memory storage occupied by the object is set to binary zeros. More precisely, if T is a built-in data type, an enumeration type, or a pointer type, the storage is set to the value of 0 converted to T. For aggregates and class objects, zero-initialization means one of the following:

  • For a class type, the storage for each data member and each base-class subobject is zero-initialized.
  • For a union type, the storage for its first data member is zero-initialized.
  • For an array type, the storage for each element is zero-initialized.

However, if T is a reference type, no initialization is performed because there are no null references in C++.

Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date