3 ms·
For many years now I treat C++ as "C with destructors and the STL". Examples: 1. RAII: https://github.com/akkartik/mu/blob/61fb1da0b6/010vm.cc#L484 https://git
by akkartik 10y ago
For many years now I treat C++ as "C with destructors and the STL". Examples:
1. RAII: https://github.com/akkartik/mu/blob/61fb1da0b6/010vm.cc#L484 https://github.com/akkartik/mu/blob/61fb1da0b6/010vm.cc#L484
2. STL: https://github.com/akkartik/mu/blob/61fb1da0b6/020run.cc#L50 https://github.com/akkartik/mu/blob/61fb1da0b6/020run.cc#L50
I really don't use anything else.
- krylon 10y agoOh yes, don't forget RAII as I did! (The name is super-awkward, but the concept is mind-blowingly awesome when it fully sinks in.) Other languages have begun to pick up on this, think of Python's with-Statements, and C#'s using (x = SomeClass())-blocks. but C++ still makes it easier to take advantage of this feature. Unless you play around with setjmp/longjmp. But to do that, you have to be ... special enough to not care about deterministic invocation of destructors in the first place. ;-)