News for hackers. Stuff that matters.
Re:I love coding in C by swiley on Thursday December 26, 2019 @10:04AM (#21884247)
This [1] explains how to create them using nested functions. Near the end is a quick blurb about the implementation which is probably why c++ doesn’t do it that way.

[1] https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html

Re:I love coding in C by saagarjha on Thursday December 26, 2019 @10:09AM (#21884287)
Oh no, nested functions are a terrible, insecure hack that are far too verbose to be ergonomic closures :(
Re:I love coding in C by swiley on Friday December 27, 2019 @08:36AM (#21891234)
Of course, that’s why I said it’s good for hacking.

Although I’m not sure I agree about the “ergonomic” thing.

Re:I love coding in C by amiga_500 on Thursday December 26, 2019 @10:11AM (#21884296)
Wouldn't you just use a lambda nowadays?
Re:I love coding in C by im3w1l on Thursday December 26, 2019 @10:30AM (#21884422)
Not in C you wouldn't.
Re:I love coding in C by saagarjha on Thursday December 26, 2019 @10:36AM (#21884481)
You can with Clang’s blocks extension: https://en.wikipedia.org/wiki/Blocks_(C_language_extension)
Re:I love coding in C by amiga_500 on Thursday December 26, 2019 @10:41AM (#21884526)
Sure, but the parent post was saying they didn't like nested function handling in c++.
Re:I love coding in C by im3w1l on Thursday December 26, 2019 @01:48PM (#21885790)
Nested functions don't exist in C++ (except for lambdas).
Re:I love coding in C by MiroF on Thursday December 26, 2019 @11:16AM (#21884777)
Agreed - this feature seems useless in modern C++