Most of my personal issues aren't with C++ syntax as such (although it also has many problems). My main gripes are: 1. Very slow compilation. 2. Poor encapsulation, adding private functions requires recompiling all dependents, see (1). 3. Comically huge symbols make debugging much harder than it needs to be -- today gdb OOM'd my 16GB laptop when trying to form a backtrace of a typical QT application coredump. Unfortu…
Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
21–30 of 174 posts
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#22I actually wish ++ and -- operators were removed. This would simplify everything, nothing to remember whether it's prefix or postfix operator, whether it copies something or not, you would just do "value += 1" and be done with it.
- Less mental overhead.
- Remove an extra way of doing the same thing.
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#23Most of my personal issues aren't with C++ syntax as such (although it also has many problems). My main gripes are: 1. Very slow compilation. 2. Poor encapsulation, adding private functions requires recompiling all dependents, see (1). 3. Comically huge symbols make debugging much harder than it needs to be -- today gdb OOM'd my 16GB laptop when trying to form a backtrace of a typical QT application coredump. Unfortu…
under what circumstances does (2) hold? for vanilla methods it's no problem
Even worse, this dependency is transitive. Dependencies to allow defining these private methods an fields are exposed too, forcing inclusion of headers to all members of the class, even if it's only implementation details.
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#24Earlier quoted context omitted.
>>> 2. Poor encapsulation, adding private functions requires recompiling all dependents >> under what circumstances does (2) hold? To add a private member variable or function, you need to put it in the class definition in the header file. Then anything that includes the header needs to be recompiled.
they don't need to be. dependents will continue functioning, because ABI hasn't changed
But even if you managed to do that, first compilation is still much slower than it should be, because anlot of headers have to be included (transitively) to allow even declaring these fields and methods.
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#25Earlier quoted context omitted.
under what circumstances does (2) hold? for vanilla methods it's no problem
>>> 2. Poor encapsulation, adding private functions requires recompiling all dependents >> under what circumstances does (2) hold? To add a private member variable or function, you need to put it in the class definition in the header file. Then anything that includes the header needs to be recompiled.
Thinking about that, is there any case in which private functions can end up in a vtable? In that case, it'd break ABI too.
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#26> Because ++ and -- always have in-place update semantics, we never need to remember "use prefix ++/-- unless you need a copy of the old value." If you do need a copy of the old value, just take the copy before calling ++/-- I actually wish ++ and -- operators were removed. This would simplify everything, nothing to remember whether it's prefix or postfix operator, whether it copies something or not, you would just d…
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#27Unfortunately the first example already re-uses one of the less good parts of C++, the "<<" operator for std::cout, which always was a bit of a hack (including strange order of operations since << normally is left shift)
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#28> Because ++ and -- always have in-place update semantics, we never need to remember "use prefix ++/-- unless you need a copy of the old value." If you do need a copy of the old value, just take the copy before calling ++/-- I actually wish ++ and -- operators were removed. This would simplify everything, nothing to remember whether it's prefix or postfix operator, whether it copies something or not, you would just d…
I mean, there are people that already think that...
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#29Then a few years later I read the spec for std::launder that I realised C++ was not really designed to be understood.
It's a shame because it's actually a rather nice language in some ways. Here's hoping that this project or something similar takes off and separates the good bits from the bad.
Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
#30Most of my personal issues aren't with C++ syntax as such (although it also has many problems). My main gripes are: 1. Very slow compilation. 2. Poor encapsulation, adding private functions requires recompiling all dependents, see (1). 3. Comically huge symbols make debugging much harder than it needs to be -- today gdb OOM'd my 16GB laptop when trying to form a backtrace of a typical QT application coredump. Unfortu…
Adding methods changes the vtable layout so there's no way to not recompile all the dependents. There's no solution to this unless private functions are guaranteed to not be virtual.