小编Mah*_*Mah的帖子

C中定义常量之间的依赖关系?

我使用#define命令来跟踪代码和常量.我在第一个WORKLOAD_MAX中定义了4和第二行TASK_COUNT_MAX和10,并在第三行中使用了它们的乘法.

经过长时间的调试,我意识到执行代码时正确的值不适用,我必须手动设置我不喜欢它的值.(如第四条评论专栏40)

有人可以提供帮助.谢谢

#define WORKLOAD_MAX 4
#define TASK_COUNT_MAX 10
#define READY_LOOP_DEEP TASK_COUNT_MAX*WORKLOAD_MAX
//#define READY_LOOP_DEEP 40

struct workItem                         // It is a STRUCT to keep the status of task in different stages
{
    int task_ID;                            // Task ID
    int workload_ID;                    // Workload ID
};

// Read from the beginning of the readyQueue
struct workItem readFromReadyQueue()
{
    struct workItem witem;
    // Picking up from queue head
    witem = readyQueue[readyQueueHead];
    // Move forward the queue head index in rotation
    readyQueueHead = (readyQueueHead + …
Run Code Online (Sandbox Code Playgroud)

c constants

3
推荐指数
1
解决办法
47
查看次数

标签 统计

c ×1

constants ×1