Re:Coroutines are now in Clang trunk, libc++
by missblit on Friday May 26, 2017 @11:39AM
(#14424809)
And array over-runs are just the beginning! (friends don't let friends use idices over iterators)
Had a fun bug at work once where we somehow accidentally built against two subtly incompatible versions of the same library.
This actually mostly worked until some random virtual function call sometimes called the wrong function silently...
Yes, C++ without a monorepo is very difficult.
Yeah, undefined behaviour was my thought too. There's a few warts with templates etc. but undefined behaviour is the granddaddy of all skeletons on the linguistic closet.
Realistically, C++ isn't actually a well-defined language unless you specify platform and language. You don't program in C++. You program in a C++-derived language jointly defined by the compiler and the hardware.
Re:Coroutines are now in Clang trunk, libc++
by marcosdumay on Friday May 26, 2017 @10:37AM
(#14424333)
Besides the confusing error messages, C++ templates also tend to be weakly typed.
- Generally C++ uses the OS-level package manager, like rpm or dpkg. It's not cross-platform and it doesn't have a nice interface in the source code (#include is... unfortunate), but there is a nice solution here if your organization has the discipline and tooling expertise to make it work.
- Template metaprogramming isn't bad to use at all. Everyone uses it every time they construct a vector<>. It takes a lot of skill to write, though, and unfortunately even users of TMP can end up with nasty and bloated compiler errors. Hopefully this will be addressed by "concepts" in forthcoming versions of C++, but it might be a while before that filters down to stable C++ compilers and libraries.
- The real issue that should scare you is something called "undefined behavior". It's very easy to do subtle things that cause you programs to break in weird and hard to debug ways. Nasty side effects that could theoretically include any side effect. Like saving garbage to your production database. By doing something as innocuous as overrunning an array.
https://kukuruku.co/post/undefined-behavior-and-fermats-last...
https://stackoverflow.com/questions/367633/what-are-all-the-...
There are tricks and tools to avoid undefined behavior, but I find that most C++ engineering orgs don't prioritize the tooling (linters, UB sanitizers, etc.) needed to let engineers do this productively. Consequently, a lot of writing good C++ involves detailed coding standards and/or very detail-oriented gurus poring over code reviews.