Some languages allow nested functions (or procedures, or subroutines, or whatever you prefer to call them), others don't.
I think those can be useful and I wonder why they aren't embraced by all living programming languages.
Some languages allow nested functions (or procedures, or subroutines, or whatever you prefer to call them), others don't.
I think those can be useful and I wonder why they aren't embraced by all living programming languages.
I wanted a string which must “contain” the name of a member of a struct. The compiler should check the right spelling (at compile time).
At last I have found a possible reason to use the comma operator…
Torvalds, the creator of the Linux kernel.
In Overloading so much I've forgotten C11 and its _Generic I've talked about in Type-generic functions (overloading) in C11.
How do you get the length of a string literal in C?
As per Michael Stoffregen suggestion in the comment, I've tried to move arguments outside and it worked (even with gcc 4.9.2)! So I can finally say C(11) has Fortran-like function “overloading” — type generic functions.
I have often wondered why C hasn't any kind of function overloading. The typical answer is that we don't want to live with name mangling in C — the hell of the C++ — that would break a lot of things which must stay as they are. I agree… except that you don't need to implement it the C++ way when you have a bright example like Fortran.