This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unnamed functions, functors or, more formally, function literals


<<I'm not saying that this should be added to C since, well, then it wouldn't
be C now would it?  But I wouldn't write them off as less than useful.  Try
using it for GUI programming some time.  It's wonderful to pass a function
to be called when such and such button is pressed without having to define
it in the global or class namespace, especially if the action for the button
is something very simple.
>>

Puzzlement ... in GNU C, you can perfectly well pass the address of a
local function. Now if you are saying you want full closures so that there
are no out-of-scope problems, that's OK, but actually not many languages
*do* have full closures, and they are very hard to implement in the absence
of garbage collection (in fact I don't see anyway of implementing them with
no GC).

Certainly the suggestion of adding full closures to C is way out of scope.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]