▲ | nicoburns 4 days ago | ||||||||||||||||||||||
There are lots of C and particularly C++ ways, but you're still restricted. Want to use methods in C: nope, you can't. Want language-level tagged unions and pattern matching in either language: nope. Same for guaranteed tail call optimisation and a bunch of other things. This is especially true for C which supports almost nothing (it doesn't even have a sensible array type!). But is also true for C++: while it supports a lot, it doesn't support everything. | |||||||||||||||||||||||
▲ | mgaunard 4 days ago | parent | next [-] | ||||||||||||||||||||||
The funny part is that all of these things are easy to achieve as libraries/paradigms. Methods in C, just have function pointers as members. Common in many codebases. Guaranteed tail calls, all the compilers guarantee that function calls that are a return expression are tail calls. Tagged union in C++, it's trivial as a library, see std::variant for a bad example of it, and all the various monadic/pattern-matching variants (pun intended) people have written. C is at a disadvantage here due to lack of lambdas, but I'm sure people have built stuff using some GCC extensions. | |||||||||||||||||||||||
▲ | bigfishrunning 4 days ago | parent | prev [-] | ||||||||||||||||||||||
what changes, in your opinion, would need to be made to the C array type to make it "sensible"? C's array is simplistic, but I don't think it's not "sensible"... | |||||||||||||||||||||||
|