Re:John Carmack on Inlined Code
by a_t48 on Wednesday October 09, 2024 @05:34AM
(#41786010)
You can do this in C++, too, but the syntax is a little uglier.
[ Parent
| on HN ]
Not that bad?
int main() {
int a = -1;
[&] {
a = 42;
printf("I'm an uncallable inline block");
}();
printf(" ");
[&] {
printf("of code\n");
}();
[&] {
printf("Passing state: %d\n", a);
}();
return 0;
}Itβs not horrible, a little bit verbose though.