← All posts tagged C++

"Step 3 — Getting rid of boost
Boost is a special kind of demon. It lures you in by giving you all these cool and simple to use features, and then it beats your soul from you by increasing compilation times absurdly. There are two main problems. Problem one is that they don't care much about compile times and two, they want to have everything nice and generic ad absurdum, and they even defend it as the correct style. The result is, that changing boost::mpl::vector66 to std::variant can improve the compile time from 1:44 to 1:20 and getting rid of templates completely by using unions can decrease the compile time to 0:53. I'm talking about changing 2 headers of 2 classes in a project with 3390 files, 410k lines of code and 15Mb of source code. Everything that was compiled to Factorio, GUI, graphics library, networking, entity logic, scripting, modding, logistic system... all these things together took the same time to compile as two instances of boost::mpl::vector. Our current goal is to get rid of the boost library completely."

"Since the first member was constructed successfully, I'd expect its
destructor to be called. Granted, I don't know the exact standard
wording, but my general idea is that once a constructor call
succeeds, an object starts to exist, thus it must at some point
cease to exist, and then its destructor must be called. clang 3.5.0
and visual c++ (according to webcompiler.cloudapp.net
without the GCC extension "(a[2]) { ... }") do call the destructor
every time."

"Soon after, heavily frustrated by the speed at which we were developing in C++, we started looking into ways to speed up development without a reduction in code quality, surely the holy grail of software development. After much research, David became increasingly convinced that a new systems-level language, Rust, had something to offer. In his spare time (between about 2 a.m. and 5 a.m.) he started transposing one of our most complex libraries, Self-Encryption (the component that seamlessly splits data into smaller chunks and encrypts them), over to Rust, which at that time wasn’t even in Beta yet. This was very successful and fast! David followed a similar process with MaidSafe’s Routing library. With another successful test complete our development team was split for a few weeks while the core team remained in C++ and another team started transposing the rest of the code.
This was a risky and scary time. To split the dev team at a period when we were under significant pressure to produce a stable network seemed counterintuitive. But thankfully, going backwards to move forward paid off, and without this change there is no doubt in our minds that we would not be where we are today. It is not the intention to go into detail here about how and whether Rust is better than C++. For debates on that subject you can check out some of the threads on the forum and elsewhere. I think that is a debate as contentious as GPL vs MIT, or even Borg vs MacEnroe, fun to debate but don’t expect consensus any time soon. All I can say is that it’s working for us and allows us to iterate quickly, be more defined with our tasks and be more definitive with our timescales."

"Разработчики индийского дистрибутива BOSS (Bharat Operating System Solution), являющегося ответвлением от Debian GNU/Linux и финансируемого из государственных фондов, развивают собственный вариант ядра Linux — MOOL (Minimalistic Object Oriented Linux), примечательный подготовкой фреймворка для разработки драйверов устройств с использованием объектно-ориентированных технологий на языке C++. Более глобальной целью разработки MOOL является приведение общей кодовой базы ядра к форме, близкой к парадигме объектно-ориентированной разработки."

"У нас были три разных версии строк, два пакета для работы с Юникодом,
три фреймворка для логирования, пара функций для скачивания страниц по
HTTP и целое множество контейнеров, а также libxml, glib, OpenSSL и
протобуфы. Не то чтобы это всё нужно было для сборки проекта, но если уж
начал собирать зависимости, то становится трудно остановиться.
Единственное, что вызывало у меня опасения, — это boost. Нет ничего
более беспомощного, безответственного и испорченного, чем программисты,
использующие boost. Я знал, что рано или поздно мы перейдём и на эту

"Снилась школа, скардил из банкомата денег и прятался по коридорам хз от кого, вместо того, чтобы сбежать сразу. Обнаружил подозрительные красные квадратные точки в углах на потолке в большом количестве, и как только я понял, что это поинтеры, они понеслись за мной, перескакивая с объекта на объект. Как я понял, это были все те указатели, которые я не удалил в своём си-плюс-плюс коде. Теперь они преследуют меня во сне."

Есть студия экспресс 2013 и 2013 Nov CTP. Есть набор классов T1, T2, ... Tn, у которых определён тип Ti::R. Как в вариадике template<class ... T> class TT определить список классов R по списку? в g++ и clang работает typedef V<typename T::R ...> VR;

C++ ?

Как такой код собрать шлангом? ideone.com
o01eg@o01eg /tmp $ g++ -std=c++0x test-sfinae.cpp
o01eg@o01eg /tmp $ clang++ -std=c++11 test-sfinae.cpp
test-sfinae.cpp:10:5: error: no member named 'Serialize' in 'std::vector<std::tuple<int, char>, std::allocator<std::tuple<int, char> > >'
~ ^
test-sfinae.cpp:73:4: note: in instantiation of function template specialization 'Stream::operator>><std::vector<std::tuple<int, char>,
std::allocator<std::tuple<int, char> > > >' requested here
s >> data;
1 error generated.