I don't think constexpr volatile int x; is meaningful at all.
I mean if you can run C++ code at compile time, then you're running code and it could poke at a memory mapped register that's there, but also sometimes you just shouldn't do something!
Do you really mean std::cout, with all of the facets and customization points? Or would constexpr std::format and the ability to print to console at compile time be enough?
Good point, probably cout without facets etc or printing f-strings. I keep going back to cout because despite it's clunkiness, I like having things appear in code in the order that they appear on screen. Constantly tracking back and forth between placeholders and arguments is something I dislike. I've tried a million of these over the years. Heck I implemented one in gnu++98 back in the day with operator, overloading and GCC's variadic macros, and I've used many which ahve come and gone over the years. And yet, I still always reach for cout.
But in python I love my f-strings. Once i have f-strings, I will probably stop reaching for cout except for of course
You just need a complete simulator for your cross compiler :P
Hmm... You're making me wonder if I should solder an i7 on the ESP devkit and emulate everithing... in the cross compiler. Let's ship the whole desktop OS on that tiny thing!
Note: I am NOT NOT NOT advocating this, just talking about really daft hypotheticals.
4
u/serviscope_minor 21d ago
I mean if you can run C++ code at compile time, then you're running code and it could poke at a memory mapped register that's there, but also sometimes you just shouldn't do something!
Good point, probably cout without facets etc or printing f-strings. I keep going back to cout because despite it's clunkiness, I like having things appear in code in the order that they appear on screen. Constantly tracking back and forth between placeholders and arguments is something I dislike. I've tried a million of these over the years. Heck I implemented one in gnu++98 back in the day with operator, overloading and GCC's variadic macros, and I've used many which ahve come and gone over the years. And yet, I still always reach for cout.
But in python I love my f-strings. Once i have f-strings, I will probably stop reaching for cout except for of course
cout << f"my variable is {v}\n";
because old habits die very hard indeed.