Clojures in C(paste.ubuntu.com)2 points·by rhambasan·vor 11 Jahren·2 commentspaste.ubuntu.comClojures in Chttp://paste.ubuntu.com/10776716/1 commentsPost comment[–]rhambasan·vor 11 JahrenreplyOP here. This is not actually compliant with the C standard, just a gcc extension.It is documented at [1] and according to the documentation, the code seems perfectly legal. However, calling it twice add5(2); add5(2);leads to an "Illegal instruction. Core dumped"Even stranger, calling it twice but with a different argument leads to a a segfault instead of illegal instruction: add5(5); add5(5);[1] https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html[–]cremno·vor 11 JahrenreplyThat isn't strange. From the linked page:>But this technique works only so long as the containing function (hack, in this example) does not exit.
It is documented at [1] and according to the documentation, the code seems perfectly legal. However, calling it twice add5(2); add5(2);
leads to an "Illegal instruction. Core dumped"
Even stranger, calling it twice but with a different argument leads to a a segfault instead of illegal instruction: add5(5); add5(5);
[1] https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html