C introductory language foundation one [portability, three files involved, 7 steps of programming, compiler, linker]

Review Questions

What dose portability mean in the context of programming?

What does portability mean in the text?

  C itself is a high-level language that does not involve the underlying operation of a specific system. The C source code is compiled and linked by the compiler of the corresponding system to generate the executable machine code required by the corresponding system. Therefore, after writing the C language source code, there is no need to change or very little Changing very little code (involving a given system) can be ported in different operating systems, which is the portability mentioned in the article.

Expain the ddifference between a source code file, object code file, and executable file.

Explain the differences between source code files, object code files, and executable files.

  • The source code file is a code file written in the syntax of C language, which saves various logics and operations
  • A class file contains only the executable code of the source code file after compiling the source code file, excluding the startup code segment of different systems, and the corresponding code information referencing external or standard libraries
  • Executable files are included
    1. Executable code after source code compilation
    2. Executable code generated from external, standard library code introduced in the source code
    3. The operating system-related startup code segment (startup code)

      is a three-part code file. The executable code is system-related and can be executed.

What are the seven major steps in programming?

What are the 7 main steps of programming?

  1. [Define the program objectives]
    Analyze the real problems that need to be solved in the design, including the information that needs to be provided, the information that the system can calculate and return, the steps required in the middle, etc.
  2. [Design the program]
    Design the overall architecture of the program, including input and output data structures, related interfaces and other information
  3. Write code to implement functions
  4. compile code
  5. execute program
  6. Test and debug programs
  7. Maintenance and adjustment procedures

What does compiler do ?

What does the compiler do?

  The compiler can first check the source code for syntax errors or reference errors, and then compile the source code into corresponding executable code fragments, ready for use.

The compiler compiles the source file, which is the process of translating the source code in the form of text in the source file into the object file in the form of machine language. During this process, the compiler will perform a series of syntax checks. If the compilation is passed, the corresponding CPP will be converted into an OBJ file.

What does a linker do?

what does the linker do?

  The linker is responsible for integrating the mutual reference of each source code and the reference to the standard library into an executable file, and then adding system-related startup code segments to the executable file to generate an executable file that can be run by the current system.

  When the linker links, it first determines the location of each object file in the final executable file. Then access the address redefinition table of all object files, and redirect the addresses recorded in them (plus an offset, that is, the starting address of the compilation unit on the executable file).

  Then traverse the unresolved symbol tables of all object files, and find the matching symbols in all exported symbol tables, and fill in the implementation address at the location recorded in the unresolved symbol table. Finally, write the contents of all object files in their respective locations, and then do some other work to generate an executable file.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325442399&siteId=291194637