C++ programming style

前端 未结 16 1716
眼角桃花
眼角桃花 2021-02-07 22:33

I\'m an old (but not too old) Java programmer, that decided to learn C++. But I have seen that much of C++ programming style, is... well, just damn ugly!

All that stuff

16条回答
  •  南笙
    南笙 (楼主)
    2021-02-07 22:53

    If you are writing a C++ DLL and you put any code in the headers, you will end up with a hard to debug mess. The DLL will contain the code from the .cpp files but the users of the DLL will have some of the code inlined into themselves.

    This is really bad in Windows where you run into things like different heap allocators in different parts of the program and if you change the implementation, callers of your DLL will be using old code from the inlined headers.

提交回复
热议问题