bad function ptrs - is it dangerous ?

From: J.A. Magallon (jamagallon@able.es)
Date: Tue Oct 01 2002 - 17:51:25 EST


Hi al...

I have a little question. Let's suppose you have this:

int (*pf)(data *);
int f(data*);

so you can:

pf = f;
pf(data).

Fine. But what happens if:

void (*pf)(data *);
int f(data*);

pf = f; // gcc happily swallows, gcc-3.2 gives a warning.
pf(data).

??

In C calling convention, the callee kills the stack so nothing should
happen... or it should ?

The (in)famous graphics driver all you know is doing this with the
copy_info op for gart...

TIA

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.0 (dolphin) for i586
Linux 2.4.20-pre8-jam1 (gcc 3.2 (Mandrake Linux 9.0 3.2-1mdk))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:29 EST