Why are empty expressions legal in C/C++?

后端 未结 11 1852
囚心锁ツ
囚心锁ツ 2020-11-29 11:21
int main()
{
  int var = 0;; // Typo which compiles just fine
}
11条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 11:35

    OK, I’ll add this to the worst case scenario that you may actually use:

    for (int yy = 0; yy < nHeight; ++yy) {
        for (int xx = 0; xx < nWidth; ++xx) {
            for (int vv = yy - 3; vv <= yy + 3; ++vv) {
                for (int uu = xx - 3; uu <= xx + 3; ++uu) {
                    if (test(uu, vv)) {
                        goto Next;
                    }
                }
            }
        Next:;
        }
    }   
    

提交回复
热议问题