Well, I decided to try my hand at converting Circle to
C++ (mostly because I just got the O'Reilly book "Practical
C++ Programming" and wanted a big, 'live' program to work
on :)
I got through 99% of it without trouble, but then
encountered something I had never seen before. Fortunately,
I has Eric Green's DGC code with me, which I know works
(and I trust Eric's coding abilities :) and was able to
compare code and get it to work, so now I have a Circle
source that compiles with g++ on RedHat Linux :P
Anyway, this error is really a C thing more than a
circle thing, but it occurs in the context of circle, so
I'll ask here.
comm.c: 1554: passing 'void(*)()' as argument 2 of 'my_signal(int,
void(*)(int))'
line 1554 of comm.c:
my_signal(SIGUSR1, reread_wizlists);
my_signal has this prototype:
sigfunc *my_signal(int signo, sigfunc * func);
reread_wizlists prototype:
RETSIGTYPE reread_wizlists(void);
Neither of these helped me very much, so I took a look
at RETSIGTYPE:
#define RETSIGTYPE void
which is no problem, but then looking a sigfunc:
typedef RETSIGTYPE sigfunc(int);
Now I understand the general use of typedef, but I
have never seen it used with anything like that '(int)'
before. Obviously that was the problem, but I couldn't find
anything in any of my C or C++ books on this type of usage
of typedef, so I was completely stumped.
By comparing with Eric's code, I was able to deduce
the meaning of this typedef usage (the fix, btw, was to
change reread_wizlists to:
RETSIGTYPE reread_wizlists(int i);
along with the other similar functions in comm.c), but
I was wondering if anybody could point me to a source that
would document this type of usage of typedef (and any
other unusual usages there may be).
Edward Glamkowski, Programmer Mathematica Policy Research
EGlamkowski@mathematic-MPR.COM Princeton, NJ
http://www.mathematica-mpr.com/
"When they call roll in the senate, the Senators do not know whether
to answer 'Present' or 'Not Guilty'." -Theodore Roosevelt
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST