zoukankan      html  css  js  c++  java
  • Startup routine

    When a C program is executed by the kernelby one of the exec functions, which we describe inSection 8.10.a special start-up routine is called before the main function is called. The executable program file specifies this routine as the starting address for the program; this is set up by the link editor when it is invoked by the C compiler. This start-up routine takes values from the kernel, the command-line arguments and the environmentand sets things up so that the main function is called as shown earlier.

    Because C has no concept of "plug in". So if you want to use, say, malloc() someone has to initialize the necessary data structures. The C programmers were lazy and didn't want to have to write code like this all the time:

    main() {
        initialize_malloc
    ();
        initialize_stdio
    ();
        initialize_
    ...();
        initialize_
    ...();
        initialize_
    ...();
        initialize_
    ...();
        initialize_
    ...();

        
    ... oh wow, can we start already? ...
    }

    So the C compiler figures out what needs to be done, generates the necessary code and sets up everything so you can start with your code right away.

  • 相关阅读:
    马走日
    扩号匹配问题
    八皇后
    流感传染
    迷宫
    棋盘问题
    JAVA-初步认识-第二章-字符类型的运算续
    JAVA-初步认识-第二章-算术运算符1知识点整理
    JAVA-初步认识-第二章-算术运算符1
    JAVA-初步认识-第二章-类型运算细节
  • 原文地址:https://www.cnblogs.com/beanmoon/p/2735582.html
Copyright © 2011-2022 走看看