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]> 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] > 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.
