V3 patch causes EH failures in ILP32 mode
Mark Mitchell
mark@codesourcery.com
Wed Jun 23 19:53:00 GMT 2004
David Carlton wrote:
> On Wed, 23 Jun 2004 13:19:16 -0500, "B. Kosnik" <bkoz@nabi.net> said:
>
>
>>Just out of curiosity, can't you also change this (AFAICT) textbook
>>C++
>
> Like I said, this is a side issue - if you really want your code to
> pass -Weffc++ (and want to do that by changing the code as opposed to
> fixing -Weffc++), a little bit of ugliness may be worth it, given that
> you said elsewhere that -Weffc++ has caught real bugs. But ugliness
> it is...
I agree.
When I worked on an error-checking tool that had a -Weffc++-like feature
(and said tool was actually endorsed by Scott Meyers, no less), we tried
to figure out whether or not dynamic memory really was involved using
various heuristics. For example, "does the constructor call "new" and
assign that to a data member?" The -Weffc++ implementation in G++ is
not as sophisticated.
The reason for the Effective C++ rule in question is that if you've got
dynamically allocated memory, then you generally need a copy constructor
to do a deep copy or increment a reference count or some such. I don't
think Scott ever intended for people to go writing functions that do
exactly what the implicitly generated routine would do.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
More information about the Gcc
mailing list