Lets consider the following code:
void main(int argc, char* argv[])
{
Foo foo;
//at this point I don't need foo any more
//a lot of stuff here
}
If I only need foo
only for short amount of time,isn't it would be better to allocate it on a heap and delete before executing rest of the code?