Unnamed functions, functors or, more formally, function literals
Robert Dewar
dewar@gnat.com
Mon Mar 18 06:38:00 GMT 2002
<<This is not a sintactical sugar, this reduces an overhead required
from a programmer wanting to define a small anonymous function, and
it, nevertheless, fits well into C, it even accurately follows from
a current C standard (see my reply to Bo Thornsen).
>>
By the way sntactic sugar is all about "reducing overhead required
from a programmer wanting [to do something or other]"
so your comment here is a bit strange. Indeed your further comment that
this is always translatable to standard C confirms that we are talking
about syntactic sugar here :-)
Nested functions as implemented in GNU-C are of course much more than
SS, since they provide a fundamental expressive capability not present
in standard C.
By the way, regarding syntactic sugar, to me a much stronger argument is
that they make the code more readable rather than that they provide a
convenience for the writer.
For me, most of the time, it is actively desirable to name the function
involved, so that's why I prefer (from the reader's point of view) to
see nested named functions used for this purpose.
More information about the Gcc
mailing list