by glouwbug · 2mo ago · 0 comments
#define array(T, N) struct array##T##N { T value[N]; }
void copy(array(int, 32)* x, array(int, 32)* y) {
*x = *y;
}
int main() {
array(int, 32) x;
array(int, 32) y = { 1, 2, 3, 4 };
copy(&x, &y);
}
With (rumors of) lambdas and defer on the way, C is going the way of classic WoW.What does this mean?
We even have our Herb Sutter: Jens Gustedt
I think defer is good. It's a common type of control flow that's usually done with gotos and mistakes, and I'd say it's slightly less complex than the for loop syntax.
#define len(x) sizeof(x) / sizeof(*x)
Is arguably the feature I've waited for for 20 years