Shower thoughts: Since virtually every C/C++ program relies on undefined behavior somewhere (e.g. dlsym casts between void */void (*)(), BSD sockets), there have basically never been miscompilation bugs in the wild, technically speaking.
this is funny but the actual situation is also funny: all real C and C++ applications are written in a non-standardized, undocumented programming language that closely resembles standard C and C++ but has less undefined behavior
It's mostly that, but it happens the other way around to some extent too.
Compilers sometimes decide they should be able to do something and the standard is overly permissive. Then, eventually, maybe the standard gets aligned to what compilers actually felt like doing.
It is. it’s enabled by default in gcc, which I think makes it relevant. It has terrifying codegen, and clang thankfully refuses to support it.
In 2021, gcc will make the stack executable and execute code there if you use it. There’s a warning — not on by default. (-Wtrampolines)
I seem to recall that those were implemented by RMS in one of his weird "let's import Lisp conventions regardless of whether they make sense" moments, right?
It's a closure unable to live past the block where it's declared and depending on hacks to make it backwards compatible with function pointers.
The concept might have been nice, but they just went with a quick hack instead of designing a serious feature. It was always a hack.
Smalltalk, Objective-C, Eiffel, etc. predate GCC nested functions.
https://en.wikipedia.org/wiki/Eiffel_(programming_language)#Agents…
Could have added some syntax for a special function pointer type with a data pointer for captures and it would still be useful today. Probably widely used, and perhaps standardized.