Earlier quoted context omitted.
It's convoluted because the idea of forcing an object to always be allocated on the heap is convoluted. The real fix for this problem is the modules system, where the compiled module can expose an object's size without exposing its contents. Your example shows why header files suck more than anything about the core semantics of C++ as a language.
> The real fix for this problem is the modules system, where the compiled module can expose an object's size without exposing its contents. Exposing the object size is already too much, it's part of the ABI. The truth is : we can't have our cake (maximum perf due to stack allocation) and eat it too (hide all implementation details)
C++ and the Culture of Complexity (2013)
281–285 of 285 posts
Re: C++ and the Culture of Complexity (2013)
#282The bullet list near the end closely matches my own experience with C++. There's an inordinate number of features creating an even worse profusion of edge cases where they interact. Then the "solutions" for those edge cases usually add even more complexity. Worse, they force programmers to coddle their compilers. The ratio between what a C++ compiler will accept and what it will produce sane code for is huge . That's…
Not to do the c vs c++ thing, I too prefer c. For over 20 years actually I have preferred c to c++; all the while learning and enjoying other languages like rust. c still is missing some crucial stuff in my opinion-- there are times where I wish generics existed, and when you tie that to a trait system like in rust it's really a pity to not have something like that in c. Couple that with really great package managers…
They kinda do...
Re: C++ and the Culture of Complexity (2013)
#283Earlier quoted context omitted.
> The real fix for this problem is the modules system, where the compiled module can expose an object's size without exposing its contents. Exposing the object size is already too much, it's part of the ABI. The truth is : we can't have our cake (maximum perf due to stack allocation) and eat it too (hide all implementation details)
What's your point? Yes, those two goals are in conflict. Modules are still an improvement to the current situation with no downsides.
My point is that if you want to be entirely safe from the ABI point of view, modules don't help you at all
Re: C++ and the Culture of Complexity (2013)
#284Earlier quoted context omitted.
They’re great, really. Yes, it takes effort to master, but then you can generate faster, safer, generic code with much less effort. Source: Another everyday C++ programmer. There are dozens of us. Dozens!
It's unfortunate when your codebase is C++03 only and intends to remain that way for compatabillity with other vendors. Yay for consumer electronics!
Re: C++ and the Culture of Complexity (2013)
#285Earlier quoted context omitted.
It's unfortunate when your codebase is C++03 only and intends to remain that way for compatabillity with other vendors. Yay for consumer electronics!
Out of curiosity what breaks compatibility?