pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
[personal profile] pne

Don't copy pointers to child objects (has-a relationship) in your operator =; sharing common children this way will bite you when you try to destroy your child objects and they've already been destroyed.

Fortunately, the STL implementation we use replaces internal pointers with "magic" nonsense values after the object is destroyed so you at least get a segfault and notice.

Date: Monday, 27 October 2003 06:48 (UTC)
From: [identity profile] crschmidt.livejournal.com
"If you're lucky, you get a segfault.

If you're unlucky, you're just screwed."

Jason Zych, Data Structures in C++, UIUC 2003.

Date: Monday, 27 October 2003 06:52 (UTC)
ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
From: [identity profile] pne.livejournal.com
Very true. Especially the bit about segfaulting being the lucky case.

Profile

pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
Philip Newton

June 2015

S M T W T F S
 12 3456
78910111213
14151617181920
2122232425 2627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sunday, 4 January 2026 15:03
Powered by Dreamwidth Studios