www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [OT] initialisation in C++

reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
https://accu.org/index.php/journals/2379
https://www.reddit.com/r/programming/comments/6gqc1c/accu_initialization_in_c_is_bonkers/

Rings very much of Scott Meyer's 2014 dconf talk.
I knew it was bad but I didn't think it was that bad!
Jun 12 2017
parent reply Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Monday, 12 June 2017 at 08:37:14 UTC, Nicholas Wilson wrote:
 Rings very much of Scott Meyer's 2014 dconf talk.
 I knew it was bad but I didn't think it was that bad!
It isn't all that bad in practice, but you need an IDE to write C++ code... Basically, the type checking in C++ is somewhat weak because of backwards compatibility, but a decent IDE will for the common case add stronger typing hints for you.
Jun 12 2017
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 06/12/2017 02:08 AM, Ola Fosheim Grøstad wrote:

 you need an IDE to write C++ code
All the help is valuable but C++ code can be impossible to understand (in reasonable time) for IDEs as well. Anastasia Kazakova's C++Now 2017 talk "A look at C++ through the glasses of a language tool" was on how difficult it is for a tool to understand what a piece of C++ code is: https://www.youtube.com/watch?v=sg3BEB6JP2c Ali
Jun 12 2017
parent Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Monday, 12 June 2017 at 18:08:46 UTC, Ali Çehreli wrote:
 All the help is valuable but C++ code can be impossible to 
 understand (in reasonable time) for IDEs as well.
Probably, but when you write code with a set of tools you adapt patterns so the tools and what you do with the tools match up. So taking over a convoluted code base is different from writing a new program. But there clearly are certain areas of generic programming with constructors and initializers that can be surprisingly challenging in C++. If you want mix templated constructors that take lists of literals and many other types then you have to be careful to get the correct constructors to match up properly with the actual arguments provided. The rules of resolution are difficult to remember, which is rather counter productive. In C++ I have found that giving up some generic ambitions and making generic types simpler is the best way to stay productive. Probably true for any language, but especially true for C++ I think.
Jun 12 2017