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:
James Herod <[log in to unmask]>
Reply To:
James Herod <[log in to unmask]>
Date:
Fri, 3 Feb 1995 18:55:52 GMT
Content-Type:
text/plain
Parts/Attachments:
text/plain (47 lines)
In article <[log in to unmask]>,
Brian White d1352 <[log in to unmask]> asked:
 
> [deleted]
 
>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);
 
> [deleted]
 
>I don't understand what I'm doing wrong, particularly when the
>"void *buffer" argument in cix_read_next takes a pointer to the same
>structure that "(*perform) (void *)" is rejecting!!
>
 
Brian,
 
        You need to use a cast (or type coercion) of the form:
 
        lresult = cix_read_next (base, dset, &jphd, (TYPE) jcx372_proc_entry);
 
where TYPE (in this case) is: int (*) (void *).
 
        Notice that the coercion looks just like the prototype declaration for
param 4 above, except that the identifier is left out.  In general, this is
true for all casts.
 
        Hence your line of code should be:
 
        lresult = cix_read_next (base, dset, &jphd,
                                (int (*) (void *)) jcx372_proc_entry);
 
        The problems you noted with qsort are due to the same problem and
can be fixed in the same manner.
 
        I hope that this helps you.
 
--Jim

ATOM RSS1 RSS2