#include <stdio.h>
#include <AssertMacros.h>
int main(int argc, char* argv[])
{
int error = 1;
verify_noerr(error);
require_noerr(error, Oops); //<---- Is Oops a callback method?
printf("You shouldn't be here!\n");
Oops: ; // <--v____ Is this a method declaration?
return error; // <--^ Why the ':' followed by the ';'?
}
此代碼是從iOS documentation from 2006。我意識到在C中,沒有聲明返回類型的方法的默認返回類型是int。但這真的是一種靠這個原理的方法嗎?以及爲什麼結腸分號?我最後的想法是它的C塊,但Wikipedia says otherwise。是「糟糕:;返回錯誤;」 C中有效的方法聲明?
我很難過。
這是一個goto標籤,並聲明它是有效的。 – 2013-04-27 22:01:43
它與'switch'中的'case X:'基本相同。 – Sulthan 2013-04-27 22:06:31