csEnd(代码):代码> CS_MAX_CODE?;143373032 999 程序退出,代码为 0377

csEnd(code): code > CS_MAX_CODE?; 143373032 999 Program exited with code 0377

本文关键字:代码 程序 143373032 退出 0377 CODE gt CS MAX csEnd      更新时间:2023-10-16

当我在NS2上运行LEACH时,我得到这个错误

csEnd(code): code > CS_MAX_CODE?; 143373032 999
Program exited with code 0377.

我知道程序中有一些问题,但我不知道如何找到它们。我甚至尝试在gdb中运行程序,但是where命令给了我No Stack Trace

请告诉我如何调试并知道问题的具体原因?

so figure it out

我在LEACH

中获得了以下代码所导致的以上消息
inline double csEnd(int code)
{
   if (code > CS_MAX_CODE || code < 0)
   {
     fprintf(stderr, "csEnd(code): code > CS_MAX_CODE?; %d %dn", code, CS_MAX_CODE);
     exit(-1);
   }
   return cs_end_[code];
}

发生这种情况是因为我设置了垃圾代码

  int code;
  // some other code
  setCode(code);