This is the mail archive of the cygwin mailing list for the Cygwin 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] |
----Original Message----From: Gerrit P. Haase Sent: 30 June 2005 12:10static int hack30_pray(ax, items, func) int ax; int items; void *func; { return 0; } int main () { int ax, items; void * symref; float num; num = ((*((float (*)()) hack30_pray))(ax,items,symref)); return 0; }
S.th. wrong with your testcase?
Absolutely. There are two *VERY* bad things about that bit of code:
1) The function call is through a pointer-to-function-returning float, but the function itself returns a void *. This is likely to screw up the x87 FP stack when the caller pops a return value that the callee didn't push.
2) Also, the function call is through a pointer-to-function-taking-stdargs, but the function itself is not a stdargs function. Given the wrong calling conventions, this is liable to lead to both caller *and* callee cleaning the args off the stack.....
A name like 'hack*_pray' suggests that this is an ugly hack that the author was praying was going to work..... I am obliged to agree!
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |