This is the mail archive of the gcc-help@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: is that possible?


On 6 September 2011 14:23, Leonardo wrote:
> hello all,
>
> is the construction bellow valid in ansi C?

Yes, but this isn't a question about GCC, so would be more suitable on
a general C programming list, newsgroup or forum.

Using typedefs makes the syntax much easier:

typedef void (*func1_type)(const char*, int);
typedef func1_type (*func2_type)(const char*, int);

void       func1(const char* s, int i) { }
func1_type func2(const char* s, int i) { return &func1; }
func2_type func3(const char* s, int i) { return &func2; }

int main()
{
    func3("a",1)("b",2)("c",3);
}


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