Today, I wrote a Win32 service that listens on the socket port and regained Delphi. I felt that everything was so easy. Just a few words were completed. Previously, I used C ++ to encapsulate window service, it really hurts me. C ++ is really powerful, but it is too complicated. It takes a lot of effort to understand its syntax, let alone use it. For example:
- In Delphi, everything is Pointer. Java has no pointer at all, and C ++ has pointer and value transfer, which is very confusing.
- All functions in Java are virtual. To rewrite virtual functions in Delphi, you must specify the override keyword (otherwise, the compiler will warn ), in C ++, if the number of virtual function parameters to be rewritten is declared incorrectly or the function name is declared incorrectly, it will cause a lot of trouble (simply put, it does not require the override keyword, or the new keyword in C # to override the base class function ).
- In Delphi, reference counting is quite elegant. As long as it is an iunknown, the compiler will implement reference counting in the background, and no one will use it to automatically destroy it; while C ++ has to use a template class for its own encapsulation, then, change the pass pointer to pass the template class object with the pointer (pass by value)
- The try in the C ++ standard is not as good as that in Delphi (for example, there is no finally ).
......
......
Of course, using C ++ is still a lot of fun, for example, STL, for example, its template ............