and what about the one marked as 'NOT OK' > > for example; > > typedef void (*foo)(int, ...); > > void func1(int, ...); > > void func2(int, float); > > > > foo f1 = func1; // OK > > foo f2 = func2; // NOT OK
why doesn't it compile? since type foo can hold arguments more than 1 isn't it supposed to support func2? --- In [email protected], "Nico Heinze" <[EMAIL PROTECTED]> wrote: > > --- In [email protected], "Indika Bandara" <indikabandara19@> > wrote: > > > > yes, but the original question was to how to create a > > function pointer which can hold any number of arguments > > > > for example; > > typedef void (*foo)(int, ...); > > void func1(int, ...); > > void func2(int, float); > > > > foo f1 = func1; // OK > > foo f2 = func2; // NOT OK > > > > what this shows(as i understand) is the type foo can 'only' > > hold variadic functions. but since it can hold variadic > > functions i was hoping that it should be able to hold a > > function with a certain number of arguments.... > > u got the point? > > > > so to say if somebody wanted a function pointer type that > > can hold functions with any number of arguments then is it > > impossible? > <snip> > > As far as I know the standards, yes. You can have one or more > arguments, but not zero or more. > > Regards, > Nico >
