下面是我的代碼爲什麼我收到一個警告「沒有效果聲明」?
/* Initialise default without options input. */
options -> processHiddens = false;
options -> timeResolution = DEFAULT_MOD_TIMES;
options -> performSync = true;
options -> recursive = false;
options -> print = false;
options -> updateStatus = true;
options -> verbose = false;
options -> programname = malloc(BUFSIZ);
options -> programname = argv[0];
while ((opt = getopt(argc, argv, OPTLIST)) != -1)
{
switch (opt)
{
case 'a':
!(options -> processHiddens);
case 'm':
options -> timeResolution = atoi(optarg);
case 'n':
!(options -> performSync);
case 'p':
!(options -> print);
case 'r':
!(options -> recursive);
case 'u':
!(options -> updateStatus);
case 'v':
!(options -> verbose);
default:
argc = -1;
}
}
我想要做的就是翻轉輸入選項每次圍繞布爾語句,因此做這樣的事情
!(options -> processHiddens);
,而不是僅僅
options -> processHiddens = true;
但是在編譯的時候,我發現了以下警告:
mysync.c: In function ‘main’:
mysync.c:32: warning: statement with no effect
mysync.c:36: warning: statement with no effect
mysync.c:38: warning: statement with no effect
mysync.c:40: warning: statement with no effect
mysync.c:42: warning: statement with no effect
mysync.c:44: warning: statement with no effect
使用'打破;'您的情況,請之間! – Benoit 2010-10-24 10:39:03
洛爾好抓,完全忘了這一點。 – jon2512chua 2010-10-24 11:08:45