一個奇怪的函數參數定義及解答 |
關于一個奇怪的函數參數定義及解答 問題來源于:濤濤的blog:http://www.sysinfo.cn/index.php?action=show&id=297&page=1#cm433 解答:kernelxu:http://blog.chinaunix.net/index.php?blogId=5727 |
一個奇怪的函數參數定義及解答 |
奇怪的參數聲明: unsigned int str_len(s) t = s; 試了一下編譯可以通過,也可以正常運行... 估計跟 unsigned int str_len(register char *s) t = s; 是等價的... 可是不知道為什么要來四次if (!*t) return t - s; ++t; 不知道跟一次有什么區別... —————————————————————————————————— 我的解答: 1、是老板本的C吧,在老版本C語言中,參數類型說明允許放在函數說明部分的第2行單獨指定。 例如: int fun(s) int s; { ... } (關于流水線可查看: 1)、CPU的流水線: http://www.blueidea.com/bbs/NewsDetail.asp?id=1821795) 2)、pipeline較詳細說明: http://www.cs.umass.edu/~weems/CmpSci535/Discussion16.html 3)、《Starting Down the Pipeline》:http://faculty.uwb.edu/aberger/CSS422SP05/Articles/Pipelines%20part%201%20and%202.pdf 4)、The Intel Pentium 4 processor 20 stages of pipeline introduce: http://www.karbosguide.com/hardware/module3e14.htm
不知道是不是這樣,請高手指點! |