Re: Strange Callback function

New Message Reply Date view Thread view Subject view Author view

Martin Reddy (mxr++at++dcs.ed.ac.uk)
Fri, 28 Jun 1996 10:02:02 +0100 (BST)


> static void CullChannel(pfChannel *chan, void *data)
> {
> (chan, data);
> pfCull();
> }
>
> In above program, I can't understand the meaning of the "(chan,data);"
> statement.

It doesn't do anything - it's just there to suppress any compiler
warnings. The function requires two parameters (chan and data), but these
are not used anywhere within the function body - most compilers will
therefore give you a warning message to this effect. By including the
"(chan, data);" statement, these two parameters are actually referenced
within the function, but nothing is done with (or to) them: they return a
value, but that value is not used, e.g. you could also just do something
like "chan; data;".

I would think that most compilers could then optimise out this line so
you're not actually generating any code for it; but you stop the compiler
producing a niggling little warning message.

Martin.

+============================================================================+
| Martin Reddy Dept. of Computer Science |
| University of Edinburgh |
| e-mail : mxr++at++dcs.ed.ac.uk Mayfield Road, EH9 3JZ |
| http://www.dcs.ed.ac.uk/home/mxr/ Tel : (0131) 650 5164 |
+============================================================================+

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer.html
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:05 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.