Noel Chiappa via cctalk wrote on Tue, 11 Apr 2017 10:18:00 -0400 (EDT)
From: Sean
Conner
I really think it's for *this* reason (the
handler() example) that C
doesn't allow nested functions.
I wouldn't be sure of that; I would tend to think that nested functions were
left out simply because they add complexity, and didn't add enough value to
outweigh that complexity. (In ~40 years of programming in C, I have never
missed them.)
When block based languages evolved into modular languages (Ada,
Modula-2) they added a system with two levels: public and private
declarations. C got the same job done with its header files and separate
compilation and eventually was able to enforce that with "static"
function declarations.
If you have these two levels you will rarely (if ever) need extra ones.
-- Jecel