NOTE TO SELF: /bangs head over and over

Random irrelevance that just didn't fit into other forums. Talk about anything.

Moderator: Talkative People

Post Reply
User avatar
short
ES Beta Backer
ES Beta Backer
Posts: 548
Joined: Thu Apr 30, 2009 2:22 am
Current Project: c++, c
Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
Programming Language of Choice: c, c++
Location: Oregon, US

NOTE TO SELF: /bangs head over and over

Post by short »

/rant

I'm really trying to make this stick in my head, as I seem to have done it three or four times, and spent way too long trying to debug it each time.. This post will serve as a conscious reminder to myself, if I run into the issue again I can at-least look at my post history here and remind myself..

DO NOT pass a stack-allocated object to a smart pointer.

I'm not sure why I can't seem to remember this. I keep allocating memory on the stack (usually a great thing). But then failing all over the place and passing its memory address to a smart pointer.... this leads to a nice double delete "feature."

/endrant

Anyone else found this out the long/difficult way? Or am I the only one............
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
Post Reply