ChinaUnix.net
相关文章推荐:

define do while0

从新写一段清楚的代码 ipsec_rcv.c543行(freeswan中的文件) [code] if(tdbprev == NULL) { spin_lock(&tdb_lock); } #ifdef CONFIG_IPSEC_IPCOMP if (proto == IPPROTO_COMP) { unsigned int flags = 0; if (tdbp == NULL) { spin_unlock(&tdb_lock); KLIPS_PRINT(debug_rcv, "klips_debug:ipsec_rcv: " "Incoming packet with outer IPCOMP header SA:%s: not yet suppor...

by odin_free - C/C++ - 2003-05-08 18:11:54 阅读(1331) 回复(2)

相关讨论

// setup int status = 0; do { // preconditions status = doSomething(); if (status) break; status = doSomethingElse(); if (status) break; // computation status = doWhatYouWantedToInTheFirstPlace(); } while (false); // cleanup return status;

by 南无小和尚 - C/C++ - 2009-03-05 14:14:01 阅读(1087) 回复(8)

do..while 是重复叙述的循环,可以分成两种模式。 最单纯的就是只有 while 的循环。用来在指定的条件内,不断地重覆指定的步骤。语法如下 while (expr) { statement } 其中的 expr 为判断的条件,通常都是用逻辑运算符号 (logical operators) 当判断的条件。而 statement 为符合条件的执行部分程序,若程序只有一行,可以省略大括号 {}。 下例很有趣,要电脑的浏览器出现十次 "以后不敢了" 的字符串,前面并加上数字,表示说了...

by 剑心通明 - php文档中心 - 2008-04-17 18:22:09 阅读(579) 回复(0)

EmpireHawk# dmesg Copyright (c) 1992-2002 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 4.7-RELEASE #0: Wed Apr 21 11:31:36 GMT 2004 root@EmpireHawk.bta.net.cn:/usr/src/sys/compile/EMPIREHAWK Timecounter "i8254" frequency 1193182 Hz CPU: Pentium 4 (1598.65-MHz 686-...

by EmpireHawk - BSD - 2004-04-22 13:12:26 阅读(843) 回复(2)

fpin=fopen("1.txt","w"); fpout=popen("/bin/ls","r"); while(fgets(line,MAXLINE,fpin)!=NULL) { if(fputs(line,fpout)==EOF) printf("error"); } 是正确的 而 fpin=fopen("1.txt","w"); fpout=popen("/bin/ls","r"); do { if(fgets(line,MAXLINE,fpin)==NULL) printf("error"); }while(fputs(line,fpout)!=EOF); 错误那? 下面的那一个是死循环; [ 本帖最后由 mu_mu8309 于 2006-12-1 15:04 编...

by mu_mu8309 - C/C++ - 2006-12-04 08:14:42 阅读(858) 回复(4)

一直觉得do {} while (false)在写宏时比较有用,但刚刚看到有人这么用: [CODE] do { if (first_condition) break; if (second_condition) break; if (outer_condition){ if (inner_conditio){ break; } } .... } while (false); [/CODE] 据说这样写可以不用goto,但个人感觉并不比用goto好,而且还多了一层嵌套,大家怎么认为呢?或者作者还有什么别的用意?

by bidongliang - C/C++ - 2009-07-07 16:29:07 阅读(10799) 回复(55)

[code]#include int main() { int get; do { printf ("Press X and x to exit. any other key continue\n"); get = getchar(); }while(get != 'x' || get != 'X'); // 这是若是没有“||”,就不会有问题,现在似乎执行了两次{}里的内容,不知道是为什么 }[/code]

by liec - C/C++ - 2008-03-27 13:29:24 阅读(838) 回复(7)

main() { int count=1,sum=0; do { sum=sum+count; count++; } while(count<=100) printf("sum=%d\n",sum); } [root@mylinux c]# gcc dowhile.c dowhile.c: In function `main': dowhile.c:9: error: syntax error before "printf"

by xi2008wang - C/C++ - 2007-11-26 18:07:34 阅读(1323) 回复(4)

如题,把一个宏定义成do {} while(0); 到底有什么作用。 请教。

by yjh777 - 内核/嵌入技术 - 2005-12-20 10:52:43 阅读(19845) 回复(29)

有一个文件内容如下: PID 28606 197 26483 3036 28488 24802 14657 24743 166 181 202 162 165 232 169 Total: 我想当第一列的数值相加,除去行内容为pid和Total,要用dowhile循环!

by xinruinet - Shell - 2005-12-12 16:40:32 阅读(1094) 回复(7)

while true do 。。。。 。。。。 done 如何结束循环的。返回0则是true吗?我写了一个死循环。 特别伤心。 //cry

by text2002 - Shell - 2004-04-30 21:24:04 阅读(1002) 回复(1)