看书发现一个有趣的程序 cdecl ,它存在于UNIX文化中
书中介绍
如果你使用的是UNIX系统,并能访问Internet,你可以获得一个名叫 cdecl 的程序,它可以在C语言的声明和英语之间进行转换。它可以解释一个现存的C语言声明 ... cdecl 程序可以帮助你分析复杂的声明 |
Debian GNU/Linux 的描述
$ dpkg -s cdecl | sed -n '/^Description: /,//p' Description: Turn English phrases to C or C++ declarations Cdecl is a program which will turn English-like phrases such as "declare foo as array 5 of pointer to function returning int" into C declarations such as "int (*foo[5])()". It can also translate the C into the pseudo- English. And it handles typecasts, too. Plus C++. And in this version it has command line editing and history with the GNU readline library. $ |
再看看他长什么样子
$ cdecl Type `help' or `?' for help cdecl> explain int (*i)[10]; declare i as pointer to array 10 of int cdecl> declare i as pointer to array 10 of int int (*i)[10] cdecl> exit $ |
很容易用 :)
如果用户的母语是英语就好了,不用将 int (*i)[10] 对应的“declare i as pointer to array 10 of int”再翻译成中文
“声明一个变量i,i是指针,它指向一个长度为10的数组,数组元素类型为整型”
想象一下国外熟悉英语环境的学生,他们刚学C语言时,如果对一些费解的声明感到疑惑,问问 cdecl 就行
那我们呢?我们努力学好英语,或者还是将这些程序中文化、本地化?
你说呢?
UNIX文化的学习,GNU/Linux的普及,路还很长很长
时间:2010-02-13 07:42
来源:Linuxeden
作者:c-aries
原文链接