2014-01-09 10:50 GMT-03:00 McLeod, John <[email protected]>:
> In short, don't use memset on any structure that includes a class.  Tthe 
> class constructor may intentionally set internal variables that are not 0.  
> The implementation of each class may vary from platform to platform, and may 
> vary over time.  These bugs can be hard to track down.  Much better is to use 
> classes and constructors / destructors for everything.  The built in default 
> constructor if you don't declare one is supposed to set all values in the 
> class to 0 or null.  The  built in destructor does nothing.

Here are five real (fixed) bugs caused by memsetting things that
aren't supposed to be memset:
http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=commit;h=8728c049
http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=commit;h=56391da2
http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=commit;h=2ac1ae43
http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=commit;h=10a80413
http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=commit;h=3db80eb5

-- 
Nicolás
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to