Certainly don't write any new code that uses mem* on classes or structures.
From: [email protected] [mailto:[email protected]] On Behalf Of Eric J Korpela Sent: Thursday, January 09, 2014 11:05 AM To: McLeod, John Cc: [email protected] Subject: Re: [boinc_dev] MemSet and C++ Classes. I'd even extend that to "Do not use mem*() on any structure or class in C++. Write a default constructor, a copy constructor (if appropriate), an operator =() (if appropriate), and a clear() method if appropriate. Write destructors as necessary." On Thu, Jan 9, 2014 at 5:50 AM, McLeod, John <[email protected]<mailto:[email protected]>> wrote: 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. _______________________________________________ boinc_dev mailing list [email protected]<mailto:[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. _______________________________________________ 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.
