Re:Why I don't spend time with Modern C++ anymore
by humanrebar on Wednesday May 18, 2016 @08:12AM
(#11721323)
Right. C++ objects are values, not references to values like in almost all other languages. So C++ needs to know the sizes of everything to construct them. If you tried to write out the mathematical series describing the ultimate size you would need to allocate for A or B, you would end up with a value approaching infinity.
Re:Why I don't spend time with Modern C++ anymore
by TheCoelacanth on Wednesday May 18, 2016 @10:49AM
(#11722354)
This is probably my favorite thing about C++. Values are so much easier to reason about than references.
Re:Why I don't spend time with Modern C++ anymore
by Ygg2 on Wednesday May 18, 2016 @01:19PM
(#11723646)
It's more of a simplification. Although, I did try references and they didn't compile either. In fact, if I remember correctly the error was "forward declaration forbidden".
After spending about 10-12 years away from C++, I was pretty much on novice level. I remember some things, but most details and day to day specifics are gone. It did serve as a fresh reminder why I hate C++. Or more precisely, why I hate C++ compilers.
Disallowing cyclical dependencies via pointer would make no sense though.