On 4/19/07, Indika Bandara <[EMAIL PROTECTED]> wrote: > 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?
foo can only hold a function with 2 'arguments' which are an int, and a varadic list. Since float is not compatible with a varadic list, it cannot be assigned the value of func2. (Details in the Standard[tm] aside, it has to do with how the compiler deals with the varadic list - it could be passed in as an array of void* for example, which clearly isn't of type float.) -- PJH // lookit me! i'm a 4 star programmer! char ****buf;
