HP3000-L Archives

February 1995, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Bruce Toback <[log in to unmask]>
Reply To:
Bruce Toback <[log in to unmask]>
Date:
Fri, 3 Feb 1995 14:54:29 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
Brian White writes:
>I have a function which takes a pointer to a function as an argument --
 
>long cix_read_next (char *base,   char *set,
>                    void *buffer, int (*perform)(void *));
 
>is the prototype.
 
>The problem is when I try to make this call:
 
>int jcx372_proc_entry (job_pfm_hist_dtl *jphd);
>lresult = cix_read_next (base, dset, &jphd, jcx372_proc_entry);
 
>the compiler tells me that the pointers are not assignment compatible for
>argument 4 - the pointer to the function. If I remove the "void *" from the
>prototype of the "perform" function in the prototype of cix_read_next, the
>compile works,
 
The compiler is telling the truth. The prototype requires a pointer to
a function that returns an integer and takes a generic pointer as a
parameter. You're passing a function that takes a
job_pfm_hist_dtl * -- a specific type -- as a parameter.
The two aren't the same; cix_read_next wants a function that can
accept ANY type, and you're giving it one that can accept only one
type.
 
>Can anybody out there help me?
 
You could switch to C++, and define your acceptor function to accept
a pointer to an object that's the superclass of all of the possible
classes of IMAGE records, but I'm not sure how you'd get it compiled
on the HP3000 :-).
 
 
-- Bruce
[log in to unmask]

ATOM RSS1 RSS2