-
I think it's okay, now the system is mostly written in C, but it may be written in C at the beginning, and then the system is bigger, it is difficult to change it to C++, because the system is relatively large, so I think it is good to write in C++, easy to control, of course, the speed is to be discounted, but stability and flexibility should be more important, after all, the slow is better than the unmodifiable and the old crash, and the speed of C++ is not much worse than C, and even faster in some places, because now C++ development is much faster than CAs Bjarne Stroustrup said, learning C is just about dealing with the ** that is being taken as a legacy, hehe. I wonder if that's a bit too much?
As for compilations, they are generally impossible to write, and a little too large is difficult to maintain. Although he is very fast, it does not mean that the program written in C++ is necessarily slower than the assembly, the compiler will optimize the C++, if the assembly level is not enough, the program may not be as good as C++. With a large program, it is almost inevitable that the assembly will be difficult to maintain.
c is first compiled into assembly and then compiled into binary, in fact, assembly and binary ** are one-to-one correspondence, but the number of 0101 is replaced by mov and other statements.
To the anonymous person, I would like to add that C++ is just a programming idea, it is all compiled into assembly and then converted into binary, C++ can be compiled into assembly, can you say that assembly supports classes? The difference between C++ and C is not that there are classes, the real difference is in thought, as for what support is not supported is just an interface and other questions that are not a problem. The so-called intermediate-level language high-level language is only for the proximity to human language in the writing process, and it is a machine language when it is compiled, what is the difference?
-
c and assembly adapted to the writing operating system.
c do interfaces? You mean VC! Pure C can't be used as an interface! VC can.
C++ can be embedded in assembly, but it's not a sentence or two that can make it clear! You can google it, and you can refer to any answer that comes out there! C++ assembly mix writing requires a high level of C+ and assembly.
Assembly and C compilation, if you have read the compilation principle, you will know that the C compiler is nested inside an assembly compiler, he first translates C C++ ** as assembly**, and then translates it as 1 0
-
Nonsense, C++ classes don't work at all in the core part of the operating system! Object-oriented thinking can only be used for upper-level development such as interfaces, and the low-level is still to use the C language of the process, and if you insist on C++ development, you can only use functions like C, not classes. Because those features are to be supported by the system, wait for your system to complete the core, and then write the interface, don't try to write the system with classes.
That's not possible because the operating system is not an application, it is bottom-level-oriented. An intermediate layer program that runs on the ring0 level. The C language happens to have the characteristics of an intermediate language.
That's why writing an operating system is so intimate.
What languages end up in binary? Don't make me laugh, you will eventually become binary, but if you think about it, how many routes do you have to go through to complete a thing in the middle, I tell you, there are many, such as classes, constantly pointing to and from pointers, of course, slowly, so I said that object-oriented thinking is just convenient, and there is no high execution efficiency at all, because in order to improve the efficiency of programming development, it is necessary to lose efficiency, if you write in a procedural language, it will be much faster (C language is finally converted into assembly and then compiled into binary, So it's still not as fast as assembly, and C++ is the slowest, because it takes a long time to become a machine code), which is the truth.
-
Let's just say that the Windows XP operating system is written in C++.
-
I don't know what your tests are for.
But want to be more efficient. You can try changing both scanf and printf to file input and output. You canf doesn't enter by hand, do you? Estimates are data prepared in a single file.
-
Save your data in a file! Let's let C read the file.
-
There's no software to sneak into.
-
In general, bootloaders are written from assemblies. At this stage, the runtime environment (C library runtime) is initialized so that the C C++ program can be run as soon as possible. In C C++ it is not common to use arm assembly again.
If you need to access special registers (when porting an operating system, just like UCOS needs to modify CPSR, SP, etc., when you need to modify it, you need to have an inline assembly). In fact, assembly is used in the low-level porting process, and in C++ it is necessary to access special registers (which are usually migration-related), and it can only be accessed by means of inline assembly.
-
Assembly language is a low-level language and is more oriented to machine operations. C C++ is a high-level language and is far away from machine operation.
-
Assembly language, like machine language, directly controls the hardware.
Each type of CPU has its own machine language, so assembly cannot be ported.
C language, which does not directly control the hardware.
On different machines, there is corresponding compilation software, which can compile C into the machine language of your own system.
The key to easy portability: C doesn't have direct control over the hardware.
-
Assembly language is directly related to hardware, and each operator has its own hardware. So the compiler translates it directly into machine language.
The ** of C and C++ is hardware independent and depends mainly on the compiler.
Whether it's a low-level or high-level language, it's ultimately the compiler that translates it into machine language for execution.
For example, repairing a house:
One situation: the homeowner only needs to tell the contractor the design style and the required functions, and the specific implementation details are done by the contractor, such as where to buy just now, repair this or fix that first, how many people to hire, etc. In this case, the contractor is the compiler for C.
Two situations: the homeowner builds the house and implements it himself, and the specific people are hired, how much steel is bought, how deep the foundation is laid, etc., are all handled by the homeowner himself, only small details, completed by some workers or small contractors. At this point, the homeowner acts as a compiler for assembly.
Therefore, on the whole, low-level languages can grasp very detailed places, mainly used in areas with precise control of hardware, while C C++, etc., are very efficient, and can write large programs in a short time. However, compilers for C and C++ are more complex.
The so-called porting, such as a C++ text we write in Windows**:
int i=0;cout "If we want to port to Linux, we just need to copy and paste this text into the Linux compiler.
Although the implementation details of the two system compilers are different, they both end up printing a "0" to the screen
-
The main thing is that the compiler is powerful, the high-level language itself is built on the corresponding machine, the underlying things should also be built with the corresponding assembly or machine code, and finally form an environment for high-level language compilation, the top-level user can not feel the difference between the compilation of different models, so the high-level language portability is strong.
If you compare the compiler of assembly language with the compiler of a high-level language, you will see that the compiler of a high-level language is many times larger than the compiler of assembly. In turn, it does a lot of the work for the user during the compilation process (including the correspondence of the machine code and the way the registers are stored).
-
The point is that the compiler will translate C into different machine languages.
So although the microprocessor system is different, c is unified.
-
Assembly language is a low-level language and is more oriented to machine operations. C C++ is a high-level language and is far away from machine operation.
FIFA Online3 cc cards for Real Madrid are: Cristiano Ronaldo, Raul, Kaka, Cassie, Ramos, Carlos, etc. >>>More
Pick up tutorials online. I can't tell. `
This is the case with recent graduates.
Single-mindedly start a career first, women put aside first, why don't you have money and don't look like a woman. >>>More
Tell Lulouch his real name: Season 11
Shot by the Madness: Season 15 >>>More
The relationship between the two of them is very complicated To say that there is a romantic relationship is not explicitly stated in the plot of the cartoon, but CC must like Lelouch, which is not difficult to see, and Lelouch may see her more as a best partner for CC, because in their world, CC knows him best.