Why "int foo = 0;" is pointless in variable declarations

| | Comments (0)
From: What does the optimize switch do?

Part of the way down:

* We omit generating code for things like int foo = 0; because we know that the memory allocator will initialize fields to default values.
The key there is that "the memory allocator will initialize fields to default values" ... see, there's really no point in setting fields to their default values, it's just code clutter. The compiler throws it away, and even if it didn't, the memory allocator would make it entirely pointless!

Leave a comment

About this Entry

This page contains a single entry by Rob published on June 11, 2009 8:30 PM.

Coolite - File Upload Dialog & other breaking changes was the previous entry in this blog.

MySql ServerName.Log file size is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 5.02