Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nested functions are not C.

It's a gcc extension but it is not used much. Many Debian/Red Hat packages that used it had it removed more than a decade ago because the implementation did things like stuffing code into the stack and executing it. When we began hardening our machines and disallowing that kind of behaviour, those packages either had to upgraded to not use that feature or be removed.



My software and Debian package uses nested functions. I use it because code quality improves a lot with nested functions. But yes, the executable stack is a problem. I had a patch for GCC to use function designators which would have removed this problem, but it was not accepted due to some backwards compatibility issues. I think a generic solution could be a new function pointer type.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: