首页 > 代码库 > 谁说这是一段程序

谁说这是一段程序

原始地址 :http://hi.baidu.com/sqpwouwzmxalprr/item/1de4987e19df365aee1e53f5

      今天在学习Uboot的时候,发现了一个很有趣的东西,起初我还以为那是一些伪代码,后来仔细一看才发现,原来那是作者写给读者的一段话。不管怎样,我还是想分享一下。Adam Smith说分享是本性,我也这么想。

先给你们看一小段:

void no_more_time (int sig)
{
      hire_a_guru(); 
}

我想你现在肯定是把它当做C代码来读了,可事实并非如此。

事实是作者在对你说:你要是没有时间去学习怎么使用Uboot,可是你又必须得使用Uboot,那么你就去雇佣Guru吧!(我还误以为是Gru:卑鄙的我中的男主角)

如果它能勾起你的好奇心,就读读原文吧,体会一下别样的幽默。

原文:

U-Boot Porting Guide:
----------------------
[Based on messages by Jerry Van Baren in the U-Boot-Users mailing
list, October 2002]
    
    
int main(int argc, char *argv[])
{
    sighandler_t no_more_time;
    signal(SIGALRM, no_more_time);
    alarm(PROJECT_DEADLINE - toSec (3 * WEEK));
    
if (available_money > available_manpower) {
    Pay consultant to port U-Boot;
    return 0;
}
    
Download latest U-Boot source;
    
Subscribe to u-boot mailing list;
    
if (clueless)
    email("Hi, I am new to U-Boot, how do I get started?");
    
while (learning) {
    Read the README file in the top level directory;
    Read http://www.denx.de/twiki/bin/view/DULG/Manual;
    Read applicable doc/*.README;
    Read the source, Luke;
    /* find . -name "*.[chS]" | xargs grep -i <keyword> */
}
    
if (available_money > toLocalCurrency ($2500))
    Buy a BDI3000;
else
    Add a lot of aggravation and time;
    
if (a similar board exists) {   /* hopefully... */
    cp -a board/<similar> board/<myboard>
    cp include/configs/<similar>.h include/configs/<myboard>.h
} else {
    Create your own board support subdirectory;
    Create your own board include/configs/<myboard>.h file;
}
Edit new board/<myboard> files
Edit new include/configs/<myboard>.h
    
while (!accepted) {
    while (!running) {
        do {
        Add / modify source code;
        } until (compiles);
Debug;
if (clueless)
    email("Hi, I am having problems...");
}
Send patch file to the U-Boot email list;
if (reasonable critiques)
    Incorporate improvements from email list code review;
else
    Defend code as written;
}
    
    return 0;
}
    
void no_more_time (int sig)
{
      hire_a_guru();
}

                                                                                                                                                                        2014-08-08T22:21:30

谁说这是一段程序