TITLE: zero initialization of built-in types PROBLEM: James Kanze Expressions of the form `int()' have always been allowed. A (fairly) recent change to the draft standard states that they have the same value as default static initialization (in this case, 0). The earlier rules had the initailization undefined. RESPONSE: jamshid@io.com (Jamshid Afshar) Is the following legal? class Foo { int x; public: Foo() : x() // legal? {} }; and if so is it different than just: Foo::Foo() {} RESPONSE: fjh@munta.cs.mu.OZ.AU (Fergus Henderson), 28 Feb 96 Yes. [It is legal] Yes, they are different. The former is equivalent to Foo::Foo() : x(0) {} This can be deduced from the following sections of the working paper: [class.base.init] 12.6.2/3 "if the *expression-list* of the *mem-initializer* is omitted, the base class or member subobject is default-initialized (see [dcl.init])" [dcl.init] 8.5/5 "To default-initialize an object of type T means: --if T is a non-POD class type ...; --if T is an array type ...; --otherwise, the storage for the object is zero-initialized."