|
| From: | Bob McIsaac |
| Subject: | Re: [Chicken-users] Compiling Chicken with Watcom .. type errors |
| Date: | Mon, 23 Jan 2006 23:07:18 -0500 |
| User-agent: | Mozilla Thunderbird 1.0.6 (X11/20050716) |
Sergey Khorev wrote:
Hi:I moved my computer away from the internet, fired up ol win98 and tried your program. As expected, it compiled ok and printed garbage. Next I removed the cast from the function pointer proc3 p = (proc3)proc; // (proc3) cast hides errorNow the problem is exposed:- cd C:\bins\wtest wmake -f C:\bins\wtest\v1.mk -h -e wcc386 var.c -i=C:\watcom\h;C:\watcom\h\nt -w4 -e25 -zq -od -d2 -6r -bt=nt -mf var.c(14): Warning! W102: Type mismatch (warning) var.c(14): Note! N2003: source conversion type is 'void (*)(int __p1,int __p2,int __p3,... )' var.c(14): Note! N2004: target conversion type is 'void (*)(int __p1,int __p2,int __p3)' wlink name v1 d all SYS nt op m op maxe=25 op q op symf @v1.lk1 Execution complete The solution is the to have the function pointer typedef match the declaration of the pointed to function which has ellipses. typedef void (*proc3)(int a1, int a2, int a3, ...); // added 'dots' to match function Depending upon design of the source, it might be better to include <stdarg.h> which has _va_list and so on. Note that watcom provides examples of a function that iterates through variable parameters. It is at least instructive if not useful here. Hope this helps, -BobMc- |
| [Prev in Thread] | Current Thread | [Next in Thread] |