Better HN
topnewbestaskshowjobs
Log inSign up

cubbimew

7 karma · joined Jan 18, 2014 (12y ago) · 6 submissions

chemist/C++ programmer
Submissions

comment 11y ago · link · parent

The number of copy/move constructors is zero, by the way, it's not hard (well, could be one if you're using 1980s compilers)

comment 11y ago · link · parent

In my recollection, smart pointers were a fairly common C++ idiom in the early 1990s. Ref-counted shared_ptr and scoped_ptr were even proposed in 1994 for standardization, but didn't quite make it (scoped_ptr mutated into auto_ptr). There were also cow, deep-copying, intrusive, and ref-linked smart pointers. It was easy to write your own smart pointer, while GC was something alien and magic.

comment 11y ago · link · parent

How is the reference for a library abandoned over 15 years ago even relevant? (other than when researching history)

comment 12y ago · link · parent

The guide that's publicly available says "If your class needs to be copyable, prefer providing a copy method, such as CopyFrom() or Clone(), rather than a copy constructor" I think that's insane. Or, at the very least, surprising to encounter when working with someone else's code.

comment 12y ago · link · parent

> either people prefer both or prefer neither.

exceptions (specifically, exceptions from constructors) are part of what RAII is, so it's only natural that people "prefer both".

As another personal anecdote, in my experience working with a large (175MLoC at last count) mostly-C++ codebase, I can't imagine how painful it would have been if the code didn't use exceptions.

comment 12y ago · link · parent

It doesn't get any worse than that guide (except maybe EC++ or the FQA). No RAII, no class invariants, no value semantics, no streams, no operators (which means no custom Iterators, EqualityComparable or even CopyAssignable types! Such a basic feature called "insidious"). Not even mentioning the FUD about newer C++ features.