Sorry, it seems that our company's security software limits the size of the upload file. Callback function. I think this is a creative of C language. Although it is very simple, it is like how to put the eggs, but if you didn't expect, hehe. If the static entry function implements a manageable macro, Callback is a cargo-to-regulatory micro: it makes a function to add functions without recombining! But in the earliest time, there are also many people holding an objection because it uses a function pointer. Although the function pointer is flexible, because it is necessary to access the memory twice to call the function, the first access function pointer, the second is true function call. Its efficiency is not as good as a normal function. But in a less demanding environment, the function call itself is not very much, the performance of the function pointer is not particularly bad, and the function pointer is actually a best choice. However, in addition to performance, the most troublesome place will lead to "bracketing" of the program. Imagine: In the program, when you read a function pointer, if you don't know which function is pointing to this function, the feeling is really bad. (You can look at the article, use advanced program framework to avoid this) Third, Event and Message
After reading the description above, I believe how many people understand why Event and Message are used. Specific function calls bring a lot of problems (although it is efficiently, this is good). In order to improve the flexibility of the program, Event and Message are generated. The method parsed by name replaces the usual function call so that if the two parties are consistent with such resolution, it can reach a uniform. However, the role of Event and Message is not just the case. Event and Message also have functions of communication between processes. The process sent its messages to "Control Center" (simple is a message queue, and the content of the WHILE loop will continue to resolve the queue, the control program gets the message, distributes to the corresponding process, so other processes can Get this message and respond. Event and Message are flexible because you can add or close a process at any time, (just a list of purchasing distribution messages) Event and Message will feel the same, just the concept. Event is mostly used to refer to an action, such as what happens in hardware, what functions need to call a function. Message is mostly used to refer to an indication, such as what is the operation command, and more. Fourth, small knot
In fact, the programs are the same as writing articles, they have an outline first, then slowly enriched. First abstract to get the skeleton of the program, then consider other contents of all aspects: What happens when the program is extremely? The function of this place is still not perfect, and will there be any problem with the future? Is the program scalable? This series of articles is some of my experiences in these phases. The purpose is to throw bricks, hoping to communicate with you, get more knowledge. Liyuming1978@163.com (this mailbox has previously issued a post of COwen, now it is fast into the garbage mailbox, huh, huh, the power of the network is really powerful)