记一次VS2017的灵异事件

2022-08-09  本文已影响0人  沐一同学
struct t_struct {
  int x;
  int y;
}
t_void my_func2(t_void* hp, t_struct* st)
{
  printf("show my_st, x: %d, y: %d", st.x, st.y);
}

int main() {
  // call
  struct t_struct st;
  st.x = 100;
  st.y = 200;

  my_func2(&st);
  
  return 0;
}

编译没有报错,上述代码是。
调试几次,发现打印de都不对(真实情况非打印),梳理好久,debug发现进入函数前,数据完全正确,到了函数内就乱码。
......(几番折腾)才发现,调用得接口参数不一致。

奇怪:vs2017居然不报错,只有警告。

上一篇 下一篇

猜你喜欢

热点阅读