⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stack.cpp

📁 是内存受限系统设计的代码。
💻 CPP
字号:

#include <iostream.h>

void TestFunction() {
	static recursions = 0;
	if (++recursions < 50)
		TestFunction();
}

/* 'base' of the stack is at RThread().Heap()->Base();
    Max size is returned by RThread().GetRamSizes();
	Unused stack is filled with 0x29292929
*/

const TInt KTagValue = 0x29292929;

void StackUsed() {
	TInt stackSize;
	TInt heapSize;
	(void)RThread.GetRamSizes( heapSize, stackSize );
	TInt count = 0;
	for (   TInt* p = &count; 
			count < stackSize ; 
			p--, count+=sizeOf(TInt))
	{
		if ((*p==KTagValue) && (*(p-1)==KTagValue))
			return (RThread().Heap()->Base() - (TInt8*)p);
	}
	return 0;
}

int main( int, char** ) {

};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -