From my perspective, C and C++ are pretty much the same. What I mean is in terms of programming syntax and semantic. C programming syntax is still compatible under C++ environment where the file extension was saving under CPP file. But if C++ syntax was saving under C extension and try to compile it with C compiler, it will prompt a syntax error.
I have compiled a list of key note for C programmer making transition from C to C++:
- C++ has smart pointer whereas C is pointer.
- C++ adopted functor whereas C is using function pointer.
- Memory allocation should adopt RAII technique.
- Should not rely much on structure whereas should focus more on object design.
- Should familiar with template design as this will utilize the code reuse concept.
- Error handling should be done on one side by using exception. Return code only indicate the status of the execution of a process, not to instruct what should be done next.
- Multiple inheritance should use carefully because this will increase the risk of code maintenance as the hierarchy level was increase.
- goto keyword should use extensively in the code as this will lead the program flow much more complicated.
- Accelerate C++: Practical Programming by example
- Effective C++
- Exceptional C++ and More Exceptional C++
No comments:
Post a Comment