was the idea of nested functions considered to be useless during the time of developing older c++ standard, because its usage is basically covered by another concept like object-oriented programming; or it wasn't implemented just as a matter of simplification?
Garrett2011
0
Light Poster
Recommended Answers
Jump to PostThe reason is that it is difficult to implement nested functions in a way that maintains compatibility with C and other compilers. For example:
extern void f(void (*)()); int main() { int x; void g() { x = 42; } f(g); }
In order for this program …
Jump to PostAFAIK, the main advantage of nested functions in languages that have them is to provide support for closures. http://en.wikipedia.org/wiki/Closure_%28computer_science%29
Closures typically appear in languages that allow functions to be first-class values, in other …
All 8 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
arkoenig
340
Practically a Master Poster
vijayan121
commented:
that was a lucid explanation. thanks.
+6
Garrett2011
0
Light Poster
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
vijayan121
1,152
Posting Virtuoso
arkoenig
340
Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.