3 ms·
I'm not that familiar with C, or C++. My impression is that void is a special case that doesn't need to be special, some accidental complexity that came from ma
by ackfoobar 2y ago
I'm not that familiar with C, or C++. My impression is that void is a special case that doesn't need to be special, some accidental complexity that came from mapping machine instructions to a higher level language.
- rerdavies 2y agoIt's kind of baked into C grammar. And there's absolutely no compelling use-case to fix it in C. In C++, there's a very compelling case for making void an actual type, because you can't use void as a templated type, which means that templates involving functions that potentially have void return types require unpleasant amounts of template metaprogramming. Now that C++ standards committees are considering basic usability fixes (e.g. the long overdue ability to do`namespace com::microsoft::directx { }`) there's a vague possibility that somebody might look into actually fixing this some time before 2040.
- a_t48 2y agoThat namespace thing has been in since C++20, right?
- zorgmonkey 2y agoPretty sure the namespace thing was in C++17
- a_t48 2y agoAh yeah, I read the page too fast.
- rerdavies 2y agoRight. Only took 37 years to fix a usability issue that Stroustrup fully expected to be fixed at the first available opportunity. C++17 and C++20 both took up usability fixes. std::string::ends_with would be a a C++20 example. Hopefully C++23 will be similarly open to usability fixes.