In C++, the statement 'k = int()' will zero 'k'. This somewhat inconsistent behavior (e.g. initialize a struct with a default constructor is a no-op) is somewhat annoying because it results in all STL containers zeroing their contents. I've encountered a few rare cases where this resulted in a significant performance hit but the most annoying part is that it prevents tools like valgrind from detecting the use uninitialized values taken from STL containers. It would be nice if g++ had a flag to optionally disable this behavior (make the constructors for build-in types be no-ops.)
-- Summary: would like flag to disable constructors for built-in types Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kraftche at cae dot wisc dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39798