Re:GCC 6.1 Released
by kkylin on Wednesday April 27, 2016 @11:06AM
(#11581026)
It also depends a little bit on your style of programming. For example, in C code, I personally like using gcc extensions like nested functions. As far as I know this is not supported by clang (but perhaps someone more knowledgeble can chime in).
[ Parent
| on HN ]
Re:GCC 6.1 Released
by Kristine1975 on Wednesday April 27, 2016 @12:39PM
(#11582046)
>nested functions
They are not supported. In C++11 you can use lambdas:
auto const local_func = [&](...) {
...
};
And then later: local_func(...);
Re:GCC 6.1 Released
by CyberDildonics on Wednesday April 27, 2016 @02:00PM
(#11582868)
Not only that but you can even create a struct inside a function and overload operator(). I don't know if this is possible in C++03 or not.
Re:GCC 6.1 Released
by Kristine1975 on Wednesday April 27, 2016 @02:52PM
(#11583431)
>I don't know if this is possible in C++03 or not.
It is/was. It could be used to manually create a lambda function.
Re:GCC 6.1 Released
by lultimouomo on Wednesday April 27, 2016 @03:28PM
(#11583725)
But note that you cannot use such class as a template parameter, as it has no linkage. Which makes it mostly useless, since you usually want to use lambdas with templates.
This restriction has been lifted in C++11.
Re:GCC 6.1 Released
by CyberDildonics on Wednesday April 27, 2016 @04:22PM
(#11584204)
Inside of a function too?