开发者

local and dynamic allocating

I have a tree and I want to release the allocated memory, but I face a problem that a pointer may refers to a variable tha开发者_如何学JAVAt isn't dynamically allocated,so how to know wether this pointer refers to dynamic a variable or not


This is compiler-specific. You may compare given pointer with pointer to a local variable. Result interpretation depends on the way compiler implements heap and stack. Generally, for given compiler, stack pointer is always less (or greater) than heap pointer. In any case, THIS IS BAD DESIGN. This may not work if pointer belongs to another heap (for example, allocated in another Dll).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜