Freeing memory for non-pointer variables
I haven't done much with C++ as of yet, but I come to the language with a ton of LPC (C derivant used with MudOS) experience. To the end of learning some of the low-level stuff LPC doesn't handle (instead leaving the MudOS driver to handle it for you), I've done some reading around on memory deallocation. However, all of the deallocation operators seem to be specific to arrays.
This all happens in the winmain function before the message loop. I'm not going to be using crc and wrc beyond this part of the code, so in the interests of perfectionist optimization, I'm getting rid of them. My question is, can you use delete in this way on single (non-array) variable instances?
RECT crc, wrc;
// This resizes things so we get a client rect of 408x408 pixels.
SetWindowPos(hwnd, HWND_NOTOPMOST, wrc.left, wrc.top, 816-crc.right, 816-crc.bottom, 0);
// If I'm lucky, this wipes the no longer needed crc and wrc variables.
// If I'm unlucky, this is a really really really bad thing to do.