-
December 29th, 2008, 04:02 PM
#14
Re: Using delete on an object without new
Originally Posted by Paul McKenzie
there is no way to delete something that isn't a pointer value
Well this could be what he's after, but delete on a stack based object has to be undefined behaviour I think.
Code:
class X
{
public:
operator X*()
{
returnthis;
}
};
int main()
{
X x;
delete x;
}
PS:- How comes copy/paste from my msvc9 express ruins all indentation. Ive set to use spaces instead of tabs like on all previous versions but my code never cut/pastes properly??
Get Microsoft Visual C++ Express here or CodeBlocks here.
Get STLFilt here to radically improve error messages when using the STL.
Get these two can't live without C++ libraries, BOOST here and Loki here.
Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
Always use [code] code tags [/code] to make code legible and preserve indentation.
Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|