4 ms·
> Maybe approaching C++ as "C with Templates" is a more promising route. Genius. I'm doing this from now on.
by tines 10y ago
> Maybe approaching C++ as "C with Templates" is a more promising route.
Genius. I'm doing this from now on.
- akkartik 10y agoFor 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. ;-)