在linux内核中goto出现的频率很高,书上说是考虑到内核的执行效率。 但在下面的函数中,如果将goto换成return,那不更直接? 请大虾指教! asmlinkage int sys_execve(struct pt_regs regs) { int error; char * filename; filename = getname((char *) regs.ebx); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; error = do_execve(filename, (char **) regs.ecx, (char **) regs.edx, ®s); if (error ...
by arcsiny - 内核/嵌入技术 - 2003-05-19 21:11:06 阅读(10895) 回复(16)
不知道shell 脚本能否写成类似C里面的goto功能啊 a: # shell script a ........................ if [ ...... ]; then goto a fi # shell script b 请问上面的可行么?谢谢
要实现goto的效果该怎么办呢? 效果就和c语言中的goto一样。就是直接跳过一段代码执行。要求不用到{} 用到的地方 start(); code... $cache->end(); code... ?> function start() { code... if($cache) goto end; } function end() { end code... } 就是在类中实现一个部分缓存的东西,如果已经缓存好了,就跳过中间代码,直接到end部分,然后处理显示。 如果你们有什么好办法,不妨共享下。 好象我这...
在编程时遇到goto语句适应怎样消除,例如: cu=eta/a(n_sp) kint = 0 if( eta 〉 0.1) go to 20 do kint =1, 20, 1 pr = cu solution( w, beta, pr, aa, pd, nodes, dim) cu=0.0e0 do i=1,dim,1 cu = cu + aa(i)*mut(i) end do print " cycle=", kint, " Current estimate of theta =", cu if( abs( cu - pr ) 〈 1.0d-3) go to 20 end do 20 val(0) = eta/a(n_sp) val(1) = teta/a(n_sp)...
请教:DB2存储过程里如何定义标号和使用goto语句? create procedure aaa() LANGUAGE SQL BEGIN ................. ................. goto ERR; .................. .................. ERR: .................. END 这样不行吧?知道的说下,谢谢哦~
看的那本书真让我流汗..因为很多印错.
就以下这句: #ifdef __linux ,有地方印 #ifdef _ _linux 有地方印 #ifdef _linux
请问该是怎么样的呢? 我用的是red hat linux 8.02
#ifdef __linux
#include<linux/sockios.h>
#include<linux/if.h>
#else
#include