I just watched video[0] that argues if you can consteval something, then it must be free of UB, which seems compelling, at least for these lower level helpers.
Unfortunately, it seems memcpy is not constexpr, so cannot be used like this, but std::bit_cast actually works[1] as constexpr, so I think in C++ that would now be the most preferred use. It won't allow the union either.
Careful, only language UB is guaranteed to be detected in constant evaluation, UB in standard library functions isn't. It is a good sanity check though.
Also it seems that bit_cast in particular is going to be strengthened in this regard:
So, is it like colinux[0], but for pre-NT windows? Neat!
Back when I was still using windows (probably XP era), I used to run colinux, it was kind of amazing, setting up something like LAMP stack on the linux side was a lot easier and then using windows editors for editing made for quite nice local dev env, I think! Could even try some of the X11 servers on windows and use a linux desktop on top of windows.
When I noticed I kept inching towards more and more unixy enviornment on the windows, I eventually switched to macOS.
Apart from the obvious hack-value, I can't quite imagine even pretend use-case, with some 486 era machine, you would be limited by memory quite quickly!
What I especially like about this Windows 9x Subsystem project, is that it proves that coLinux could have been written way earlier. Now imagine how less dual booting we would have needed in 1996 if that happened, and how it would have affected VMware which only existed since 1998.
Oh it's still pretty stupid, and I think they should have simply resurrected the Wordpad name for this, and maybe a conversion utility for opening doc/rtf files to markdown in the editor for older file support.
Edit is unironically one of my favorite text editors these days. It opens incredibly fast compared to everything else I use, it's easy to use, works fine on Linux. It's not going to replace emacs or VS Code, but it's incredibly handy for basic editing chores.
> Every once in a while I pull up some Wikipedia article with idle curiosity of "If I were transported back in time, could I usefully help this get invented?"
This reminds me of the book “How to invent everything” by Ryan North, to kind of see the fast-path for many inventions :)
Jen's macro that this was based on was an implementation of his own proposal (N3434) for `defer`, which was one of a few preceding what finally became TS25755! So, yes, C2y is lined up to have "defer: the feature", but until then, we can explore "defer: the macro" (at least on GCC builds, as formulated).
Unfortunately, it seems memcpy is not constexpr, so cannot be used like this, but std::bit_cast actually works[1] as constexpr, so I think in C++ that would now be the most preferred use. It won't allow the union either.
[0] https://www.youtube.com/watch?v=-LAXqqqX274 [1] https://godbolt.org/z/xGzjTMGvv
reply