What are the differences and connections between compilers and integrated development environments?
[Copy link]
Ladies and Gentlemen, we always talk about the two names of compiler and integrated development environment, but what are the differences and connections between the two? Let's talk briefly about them today.
What we usually call programs are programs that can be run directly after double-clicking. Such programs are called executable programs.
In Windows, executable programs have suffixes of .exe and .com (.exe is more common). In UNIX-like systems (Linux, Mac OS, etc.), executable programs do not have specific suffixes, and the system determines whether it is an executable program based on the file header information.
The inside of an executable program is a collection of computer instructions and data, all in binary form, which the CPU can directly recognize without any obstacles; but for programmers, they are very obscure and difficult to remember and use.
For example, to output "VIP member" on the screen, the C language is written as:
puts("VIP member");
The binary code is:
Think about it, if you use binary directly, does it feel like you're going to bang your head against a wall, or do you suffer a ton of damage?
In the early days of computer development, programmers used such binary instructions to write programs. There were no programming languages in that pioneering era.
Programming directly using binary instructions is a nightmare for programmers, especially when the program is large. Not only is it troublesome to write, it requires frequent reference to the instruction manual, and debugging is extremely troublesome, facing a pile of binary data directly, which makes people dizzy. In addition, programming with binary instructions is cumbersome, and various boundary conditions and underlying problems must be considered, so the development efficiency is very low.
This forced programmers to develop programming languages to improve their productivity, such as assembly language, C language, C++, Java, Python, Go language, etc., which are gradually improving development efficiency. So far, programming is no longer something that only geeks can do. Readers who don't know much about computers can also write decent programs after some training.
1. What is a compiler?
C language code is organized by fixed words in a fixed format, which is simple and intuitive, and programmers can easily recognize and understand it. However, for the CPU, C language code is like a mystery, which is completely unrecognizable. The CPU only recognizes a few hundred instructions in binary form. This requires a tool to convert C language code into binary instructions that the CPU can recognize, that is, to process the code into an .exe program; this tool is a special software called a compiler.
The compiler can recognize words, sentences, and various specific formats in the code and convert them into binary form that the computer can recognize. This process is called compilation.
Compilation can also be understood as "translation", similar to translating Chinese into English and English into hieroglyphics. It is a complex process, which generally includes five steps: lexical analysis, syntax analysis, semantic analysis, performance optimization, and generating executable files. It involves complex algorithms and hardware architecture. For college students studying computer science or software, "Compilation Principles" is a professional course. Interested readers are welcome to read the book "Compilation Principles" by themselves. We will not explain it here.
Note: Not understanding compiler principles does not affect our learning of C language. I also do not recommend beginners to delve into compiler principles. It is better to bite off more than you can chew and don't confuse yourself.
There are many kinds of C language compilers, and different platforms have different compilers, for example:
The commonly used one under Windows is cl.exe developed by Microsoft, which is integrated into Visual Studio or Visual C++ and is generally not used alone;
GCC developed by the GUN organization is commonly used under Linux, and many Linux distributions come with GCC.
LLVM/Clang is commonly used on Mac, and it is integrated into Xcode (Xcode used to integrate GCC, but later it was changed to LLVM/Clang due to GCC's non-cooperation. LLVM/Clang has more powerful performance than GCC).
Whether your code is syntactically correct or not depends on what the compiler says. In a sense, when we learn C language, we are learning how to use the compiler and let the compiler generate executable programs (such as .exe programs under Windows).
The compiler can 100% guarantee that your code is syntactically correct, because even if there is a small error, the compilation will fail. The compiler will tell you where the error is to facilitate your changes.
2. What is an Integrated Development Environment
In actual development, in addition to the compiler, we often need a lot of other auxiliary software, such as:
Editor: used to write code and color the code for easier reading;
Code prompter: Enter part of the code to prompt the whole code, speeding up the code writing process;
Debugger: observes every running step of the program and finds logical errors in the program;
Project management tools: manage all resources involved in the program, including source files, pictures, videos, third-party libraries, etc.;
Beautiful interface: various buttons, panels, menus, windows and other controls are neatly arranged, making operation more convenient.
These tools are usually packaged together, released and installed in a unified manner, such as Visual Studio, Dev C++, Xcode, Visual C++ 6.0, C-Free, Code::Blocks, etc. They are collectively called Integrated Development Environment (IDE).
An integrated development environment is a combination of a series of development tools. This is like a desktop computer. The core component of a desktop computer is the host. With the host, it can work independently. However, when we buy a desktop computer, we often have to attach peripherals such as a monitor, keyboard, mouse, USB flash drive, camera, etc., because it is too inconvenient to have only the host. You must have peripherals to play well. The same is true for an integrated development environment. It is inconvenient to have only the compiler, so other auxiliary tools must be added.
3. Which integrated development environment to choose
There are many kinds of integrated development environments for C language. I have written a special introduction before, so I will not repeat it here. If you really don’t know how to choose, then go with VS, after all, it is known as the world’s number one IDE. Haha, let’s stop here, do you understand?
|