Hacker News new | ask | show | jobs
by bluGill 79 days ago
No it doesn't. It says the value is unspecified but it exists. Sometimes some compilers did initialize everything (this was common in debug builds) before. Some of them will in the future, but most won't do anything difference.

The only difference is some optimizer used to eliminate code paths where they could prove that path would read an uninitialized variable - causing a lot of weird bugs in the real world.

1 comments

> It says the value is unspecified but it exists.

The precise value is not specified, but whatever value is picked also has to be something that isn't tied to the state of the program so some kind of initialization needs to take place.

Furthermore, the proposal explicitly states that (some) variables are initialized by default:

> Default-initialization of an automatic-storage object initializes the object with a fixed value defined by the implementation

> The automatic storage for an automatic variable is always fully initialized, which has potential performance implications.

> The automatic storage for an automatic variable is always fully initialized, which has potential performance implications.