Is there a use for function declarations inside functions?

This is really a C question, because this behaviour was inherited directly from C (although it gets much more press in C++ because of the most vexing parse).

I suspect the answer (in the context of C, at least) is that this allows you to scope the existence of your function declarations to precisely where they’re needed. Maybe that was useful in the early days of C. I doubt anyone does that any more, but for the sake of backward compatibility it can’t be removed from the language.

Leave a Comment