|
|
|
|
|
by jstimpfle
2722 days ago
|
|
RAII is a disaster. Piecemeal allocation and wild jumping across the project to do all these little steps (to the point where the programmer cannot predict anymore what will happen) is not the way to go. Then all the implications like exceptions and needing to implement copy constructors, move constructors, etc. in each little structure. As to what C project doesn't just emulate RAII: Take any large C project and you will likely find diverse memory management strategies other than the object-oriented, scope-based one. Also, other interfacing strategies than the "each little thing carries their own vtable" approach. The linux kernel is one obvious example, of course. But I also want to reference my own current project since it's probably written in a slightly unusual style (almost no pointers except a few global arrays. Very relational approach). https://github.com/jstimpfle/language. Show me a compiler written in RAII style C++ that can compile millions of lines of code per second and we can meet for a beer. > The reason is, C++ doesn't impose anything on your program structure that C doesn't Of course you can write C in C++ (minus designated initializers and maybe a few other little things). What point does this prove, though? |
|
It wasn't really implemented for performance, and maybe the language is more complicated -- no doubt it's a lot slower. On the other hand, I can look at any function and see what its inputs and outputs are.