Thanks!

I understand that comment.

It sounds good to test a more general property. However I don't see a good 
simple candidate property. User classes that has various types of constructors 
can often be memset without problems. There might for instance be dataloss when 
a memset is used but imho it's difficult to see if this is intentional or not.

I do believe we could write more generic warnings when the memset leads to 
undefined behaviour such as division by zero or null pointer dereference. 
However this is not very trivial to check, as far as I see. I am not against 
this I am just not volounteering to write such check right now.


..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden

Mobile:                 +46 (0)709 12 42 62
E-mail:                 
Daniel.Marjamaki<mailto:[email protected]>@evidente.se<mailto:[email protected]>

www.evidente.se
________________________________
Från: [email protected] [[email protected]] för Richard Smith 
[[email protected]]
Skickat: den 14 november 2013 00:34
Till: Daniel Marjamäki
Cc: [email protected]
Ämne: Re: [PATCH] New warning when using memset etc on std class data

Testing for class members with types in namespace std seems extremely ad-hoc 
and rather hacky. Can we test for a more general and defensible property 
instead, like checking whether the class type has a trivial default constructor?


On Wed, Nov 13, 2013 at 3:27 PM, Daniel Marjamäki 
<[email protected]<mailto:[email protected]>> wrote:

Hello!

I'd like to get comments / reviews for this patch.

clang currently writes warnings if memset is used on a class that contains 
virtual methods.

This patch adds warnings when memset is used on a class that contains std class 
members. This can cause weird bugs.

I have seen such bugs in a closed source project. And there was also a major 
cleanup of such bugs a few years ago in boinc.

Best regards,
Daniel Marjamäki

..................................................................................................................
Daniel Marjamäki
Senior Engineer
Evidente ES East AB
Warfvinges väg 34  SE-112 51 Stockholm  Sweden


Mobile:
+46 (0)709 12 42 62<tel:%2B46%20%280%29709%2012%2042%2062>
E-mail:

[email protected]<mailto:[email protected]>


www.evidente.se<http://www.evidente.se>








_______________________________________________
cfe-commits mailing list
[email protected]<mailto:[email protected]>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to