Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question for the C++ gurus
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00368531
Message ID:
00369090
Views:
22
Charlie,

>Are all pointers created on the heap and regular variables created on stack?

No. If the pointers are object members they wouldn't be on the stack unless the whole object was on the stack.

void Func1( void )
{
SomeClass o;
SomeClass *op;
int i;
}

All of the above variables are on the stack, you have a full object (o), a pointer that would hold a reference to an object, and a plain old int.

You could do:

op = &o; // might have the syntax off a little I don't write C++ everyday now, make op point to the instance of the object o that's on the stack

op = new SomeClass; // allocate a SomeClass object on the heap and point the variable to it
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform