This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/46115] Feature request: anonymous functions (complementing anon aggregates)
- From: "robert.staudinger at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 25 Oct 2010 07:32:05 +0000
- Subject: [Bug c/46115] Feature request: anonymous functions (complementing anon aggregates)
- Auto-submitted: auto-generated
- References: <bug-46115-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46115
--- Comment #3 from Rob Staudinger <robert.staudinger at gmail dot com> 2010-10-25 07:31:59 UTC ---
For the record, this is already possible using bracketed expressions, but the
syntactical sugar of not having to pick a function name would be great.
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char **argv)
{
void (*func_ptr)(int) = ({ void func(int i) { printf ("%i\n", i); };
func;
});
func_ptr (3);
return EXIT_SUCCESS;
}