Iif I have a function defined:
如果我定义了一个函数:
int32_t function(const bool inDebugPattern)
{
char tempBuff[256]; memset(tempBuff, 0, sizeof tempBuff);
/* use tempBuff[] */
}
which is called by multiple tasks, will the memory allocation of tempBuff[]
be separate(unique) for each call of this function or will it be shared and can be corrupted by a concurrent call from other tasks?
由多个任务调用,tempBuff []的内存分配对于此函数的每次调用都是独立的(唯一的),还是会被共享,并且可能被其他任务的并发调用破坏?
1 个解决方案
#1
3
Since tempBuff is a local variable it will be unique for each function call
由于tempBuff是一个局部变量,因此每个函数调用都是唯一的
Take a look at C Scope rules
看看C Scope规则
#1
3
Since tempBuff is a local variable it will be unique for each function call
由于tempBuff是一个局部变量,因此每个函数调用都是唯一的
Take a look at C Scope rules
看看C Scope规则