This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH c++] Reduce -Weffc++ Rule 12 false positives


Dirk Mueller <dmueller@suse.de> writes:

| On Wednesday, 8. February 2006 01:04, Andrew Pinski wrote:
| 
| > Huh? the default constructor for integer types is assigning it to zero
| > but then again most of the time dead store elimination can remove the
| > dead store 
| 
| Exactly! 

Interesting, from that perspective I would have concluded exactly the
opposite of:

[...]

| Therfore 
| implicit default constructor calls are evil and should be optimized away by 
| the programmer, not by the compiler. 

trivial constructor calls leading to dead store should be optimized
away by the *compiler*, not the programmer.  Have the programmer
correct program; and have the compiler remove the abstraction
penatly.  If you put it the other way around you invite for disaster.
If you modify the compiler in that direction,  you're not doing an
improvement. 

| > so it really does not matter in general. 
| 
| It does for non-POD types. 

Notice also that, not just because the programmer does nto mention a
non-POD member with default constructor means that it that constructor
is never run.  So for non-PODs, it makes no difference whether the
programmer explicitly write the default-initialization of the member
or whether the compiler implicilty calls it.

| It doesn't for POD types, thats exactly why my 
| patch tries to suppress those warnings :)

Huh?

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]