What if anything have we learned from C++? [video]
21–30 of 56 posts
Re: What if anything have we learned from C++? [video]
#22After twenty years of using it? That I was wrong, that plain-old C really is better.
C is so tedious to write that even if I didn't have access to C++ I would try something else first when the need to write cross-platform/performant code would come.
The point is: it's not appropriate to evangelise C (or any other language) without pointing out some of its major disadvantages. This is simply spreading misinformation.
Re: What if anything have we learned from C++? [video]
#23I started programming in C++ in the late 90's and I used to be confused about what features to use and found it easy to make a mess. But I am happy I stuck with it as it opened up opportunities to work in a lot of different and interesting domains like games, mobile apps, interactive art installations, trading systems and video and film processing apps. Also, most of my code is platform independent and very efficient…
I would prefer it if we had several strong, open langauges that are complements to eachother and which would own the market so developers could focus on solving problems, not learning syntaxes and APIs. Instead we have C# and Java, Python and Ruby, etc.
Re: What if anything have we learned from C++? [video]
#24Earlier quoted context omitted.
Coding in plain C99 with some discipline can actually get you most of the benefits of C++, without any of its quirks. The "object-orientedness" of C++ really boils down to implicitly passing the this pointer to member functions, inheritance + virtual functions, and namespaces. All of these can be emulated in what I would call "C with discipline". Just be consistent in your naming conventions, always use a common pref…
What about templates? For some reason, C programmers only seem to comment about the OO parts of C++ and never talk about templates. When you bring variadic templates into the mix, it's just more awesomeness. And, before you mention it, use clang to avoid getting the page long templates related errors.
Type-generic data containers can still be implemented with void pointers and very little runtime overhead, for example: http://lxr.nginx.org/source/src/core/ngx_array.h
Re: What if anything have we learned from C++? [video]
#25That introducing kids to programming using C++ will ensure they never want to try again.
But I stuck with it and have found that learning C++ has meant that I think in C++, and transfer this to other languages when I have to write them.
Additionally, the second thing I found was that all other languages I have come across (Obj-C, Java, Swift, JavaScript, PHP, C#) all have enough commonalities in syntax and thought processes that working in them is easy. In some cases, you get to consider them "dumbed-down" C++, and it makes working in them easier (and means approaches to things are different).
So it isn't a bad language after all. Particularly with the changes in C++11, it feels like an entirely new language.
Re: What if anything have we learned from C++? [video]
#26I really wish there was a "syntactic-sugar-on-top-of-C++" language that would compile down to C++ and have 100% compatibility with the existing C++ ecosystem (so that you can just directly use a class from any C++ library). Something like TypeScript is to JavaScript, or like Kotlin is to Java. Would make the experience much nicer without having to wait on the slow C++ standardization process or deal with all the back…
On the other hand using C libraries is super easy from any language and something compiled 10 years ago still works today.
Re: What if anything have we learned from C++? [video]
#27Earlier quoted context omitted.
What I've learnt is that if you start writing C++ as a plan-old C, you quickly find yourself reaching for this and that feature from C++ that makes your job easier and your code more readable. Knowing where to stop is the tricky part.
Coding in plain C99 with some discipline can actually get you most of the benefits of C++, without any of its quirks. The "object-orientedness" of C++ really boils down to implicitly passing the this pointer to member functions, inheritance + virtual functions, and namespaces. All of these can be emulated in what I would call "C with discipline". Just be consistent in your naming conventions, always use a common pref…
I am working in DSP project which was started with typical C++ OO BS, finally with ended up with C compiled as C++ + some simple templates for cases as above.
Re: What if anything have we learned from C++? [video]
#28Earlier quoted context omitted.
Coding in plain C99 with some discipline can actually get you most of the benefits of C++, without any of its quirks. The "object-orientedness" of C++ really boils down to implicitly passing the this pointer to member functions, inheritance + virtual functions, and namespaces. All of these can be emulated in what I would call "C with discipline". Just be consistent in your naming conventions, always use a common pref…
C99 is nice, but C still lacks generic. I am not talking about C++ template nonsense, but not having to write max element search for every primitive type. I am working in DSP project which was started with typical C++ OO BS, finally with ended up with C compiled as C++ + some simple templates for cases as above.
#define MAX(a,b) ({ \
typeof (a) _a = (a); \
typeof (b) _b = (b); \
_a > _b ? _a : _b; \
})
The inability to write template functions can be compensated by designing your function so that it takes a function pointer where the type-specific action occurs.Re: What if anything have we learned from C++? [video]
#29After twenty years of using it? That I was wrong, that plain-old C really is better.
I hold the exact opposite opinion, and would never want to work on a plain C project. It is so low level that one has to write a lot of plumbing code to take care of error handling and resource management. It's also missing pretty much all higher-level concepts that are fast and can make code easier to write, read and less error-prone. Overall, it's simply not fun to write C code, there's a lot of tedious manual work…
Re: What if anything have we learned from C++? [video]
#30Earlier quoted context omitted.
Coding in plain C99 with some discipline can actually get you most of the benefits of C++, without any of its quirks. The "object-orientedness" of C++ really boils down to implicitly passing the this pointer to member functions, inheritance + virtual functions, and namespaces. All of these can be emulated in what I would call "C with discipline". Just be consistent in your naming conventions, always use a common pref…
C99 is nice, but C still lacks generic. I am not talking about C++ template nonsense, but not having to write max element search for every primitive type. I am working in DSP project which was started with typical C++ OO BS, finally with ended up with C compiled as C++ + some simple templates for cases as above.
How is it template 'nonsense', when those templates do exactly that?