Live data from Hacker News

C++ braced initializers and type deduction

scottmeyers.blogspot.ca

11–20 of 38 posts

Re: C++ braced initializers and type deduction

#11

The entirety of C++ initialization rules has become a byzantine mess of epic proportions and any change is bound to add another level of combinatorial explosion. There's just no way out of it. I can tell you how C++ will die. It will die because all C++ programmers will soon be dead for one simple reason: Our brains are incapable of knowing C++ well enough to write safe C++ code and knowing something else at the same…

Same here. C11 has driven me into mobile app development with Java and Objective C. And that's after 10+ years of C++ experience and most people consider me a C++ expert.

Do you mean C++11, rather than C11?

Re: C++ braced initializers and type deduction

#12

The entirety of C++ initialization rules has become a byzantine mess of epic proportions and any change is bound to add another level of combinatorial explosion. There's just no way out of it. I can tell you how C++ will die. It will die because all C++ programmers will soon be dead for one simple reason: Our brains are incapable of knowing C++ well enough to write safe C++ code and knowing something else at the same…

Honestly, writing safe C++ code means just following a few rules of thumb. Most importantly: never do pointer arithmetic, always use smart pointers.

Basically, 99% of your work should use only about 10% of the feature set of C++ explicitly. The vast majority of the time, you shouldn't even write templates (just use the ones in the STL and project-specific ones that make sense).

But it's really nice that those other 90% of features are there when you need them.

Re: C++ braced initializers and type deduction

#14
post #4
post #3

Earlier quoted context omitted.

Like any ANSI/ISO committee, you need to be a member to seat on those meetings and discuss everything language related. To become a member you need to pay for it, so most members are employees from compiler vendors. Everyone else only gets access to what gets published as public information, hence the doubts due to not being present in those meetings.

Thanks! (In my naive ways, I would have guessed that perhaps speaking rights were restricted, but that everyone was allowed to read and listen.) The ANSI/ISO way seems like the opposite of what you'd want in a (open) programming language, doesn't it?

The C++ working group is one of the most open ones, though. All proposal papers, meeting minutes, even the draft standard documents are freely available at http://www.open-std.org/jtc1/sc22/wg21/, as are the archives of the various mailing lists.

(BTW, if anyone upvotes this, I'm going to lose my 1337 karma. Oh well.)

Re: C++ braced initializers and type deduction

#15
Only slightly related, but I feel (I do not yet have the experience) that 'auto' is going to make the lives of those reading code 10x harder, for the benefit of those writing code to have to think and type tiny amounts less, and for the writers of template libraries to have to think 10 times less. Especially that last part concerns me great amounts.

I'm not looking forward to the first time I will have to work myself into a code base build around heavy 'auto' use.

Re: C++ braced initializers and type deduction

#16
post #10
post #8

Earlier quoted context omitted.

You get to know what is going on by posts from members, like this one https://www.ibm.com/developerworks/community/blogs/5894415f-... The ANSI/ISO way is the best way to standardize technology. The alternative being a reference implementation subject to a benevolent dictator with everyone discussing what the right license should be. Any implementor knows what is supposed to be compliant with, as long as, its implemen…

Thanks for the link! > The ANSI/ISO way is the best way to standardize technology. The alternative being a reference implementation subject to a benevolent dictator with everyone discussing what the right license should be. That's a false dilemma. You can have a standard that's discussed and decided on in a forum that's not ANSI/ISO.

That's just nitpicking. Maybe the GP could have said "The model of the ANSI/ISO way is the best way to standardize technology.", but the sentence after that described in a very apt way the vast majority of "standards" not build by a formal committee, with actual travel budgets and a commitment to make things work for the medium term (10 years, at a minimum).

Re: C++ braced initializers and type deduction

#17
post #15

Only slightly related, but I feel (I do not yet have the experience) that 'auto' is going to make the lives of those reading code 10x harder, for the benefit of those writing code to have to think and type tiny amounts less, and for the writers of template libraries to have to think 10 times less. Especially that last part concerns me great amounts. I'm not looking forward to the first time I will have to work myself…

OTOH, with auto the reader never have to worry about narrowing conversions. And any decent IDE should show the deduced type for an auto variable on demand.

Re: C++ braced initializers and type deduction

#18
the way i handle c++ complexity is to limit its feature usage to exercise its strength letting it help me solve the problem.

c++ is a big language with big grammar, as such offers a lot of different ways to say the same thing. each different construct is understood by a different set of code-readers, same way as in a complex human language. commenting c++ code is part of writing c++ due to this complexity, in my practice.

in a complex grammar, the order of words makes a difference and certain relation of grammatical constructs must be obeyed to remain comprehensive and understandable by most people.

communications using formal grammar makes it more understandable, versus slang. however both formal and informal convey the same information for the respective group of people.

in a programming language, pondering publicly about good and bad practices and their merit helps reading code, of course, with comments.

Re: C++ braced initializers and type deduction

#19
post #15

Only slightly related, but I feel (I do not yet have the experience) that 'auto' is going to make the lives of those reading code 10x harder, for the benefit of those writing code to have to think and type tiny amounts less, and for the writers of template libraries to have to think 10 times less. Especially that last part concerns me great amounts. I'm not looking forward to the first time I will have to work myself…

(C++ beginner here) I tend to use the actual type for simple enough types, typdef those template instantiations I use frequently and use auto more or less only for iterators (which are horrible to write otherwise, especially for things like map>).

Re: C++ braced initializers and type deduction

#20
post #2

How does the C++ committee actually work, if the experts can have these kinds of open questions?

Imagine in general the bikeshed problem, or more recently the "midnight evaluates to false" saga on the python mailing list, then add in the fact that every person on the committee is an expert (in fact, the world's best expert) on the entire list of issues being discussed.
Post reply on HN