c++ - Is a local scoped variable initialized to an undetermined value, or un-initialized? -


pedantically speaking, x initialized in following code or not?

int main() {     int x; } 

there paragraphs in 8.5 initializers [dcl.init] (for c++11) not backed examples.

it formally default-initialized, means ints, no initialization performed.

[dcl.init]/12 (n3797)

if no initializer specified object, object default-initialized; if no initialization performed, object automatic or dynamic storage duration has indeterminate value

[dcl.init]/7

to default-initialize object of type t means:

  • if t (possibly cv-qualified) class type, default constructor t called [...];

  • if t array type, each element default-initialized;

  • otherwise, no initialization performed.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -