FAQ 30.17 Why do programs that use realloc() to reallocate an array of objects crash?

FAQ 30.17 Why do programs that use realloc() to reallocate an array of objects crash?

When realloc() needs to move the storage that is being reallocated, it uses bitwise copy rather than invoking the appropriate constructor for the newly allocated objects.

Use realloc() only for objects guaranteed to be bitwise copyable.



C++ FAQs
C Programming FAQs: Frequently Asked Questions
ISBN: 0201845199
EAN: 2147483647
Year: 2005
Pages: 566
Authors: Steve Summit

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net