Learning Modern C++? Check out Bjarne Stroustrup’s “A Tour of C++” https://amzn.to/3514lJT The code: https://godbolt.org/z/aBz4JN My Training Classes: …



  1. How exactly would assigning a constexpr std::string work?
    `constexpr new` does not allow pointers to "escape" the constexpr context, how can it allow .data() to be?

  2. The way constexpr is evolving, compiler implementors will need to implement a C++ virtual machine. – kind of like the Java JVM or the old Pascal p machine. That way it too can be standardized in order to insure uniform cross platform behavior of this feature (compile time execution). IOW, constexpr is rapidly turning into a monster of sorts. But such a virtual machine could be the focus of where C++ behavior is rigorously defined and once good implementations exist it could be used in test suites to help compiler implementors preserve the integrity of their compilers vis a vis new language evolution.

  3. I spend a great deal of time and effort trying to avoid using heap allocation at runtime, why the heck would I want to be able to do it at compile time?

  4. So does that mean it's potentially possible to do c-style file io at compile time [with file pointers?] The use-cases for that are probably quite limited, however; the only one I could think of is some massive, complex library where previously you'd have to define macros for optional functionality and/or settings but now it could be possible to have those thing in an external file that's read at compile time… Or maybe reading in a large but unchanging data set.

  5. If the goal is to be able to use most standard library functionality, I also wonder about things like placement new / dtor calls (and thus things like double dtor call checking, overlapping objects, if standard layout guarantees can be taken advantage of), what bytes you'll read through a char*, if "type punning" is possible, if active union members are checked; and things like rtti, dynamic cast, exceptions, virtual functions; and what guarantees they have in relation to the platform being compiled for. If any features are missing, that puts a big constraint on library development.

Leave A Reply

Please enter your comment!
Please enter your name here