There some code in one gstreamer-plugin:
static GstFlowReturn
gst_ebml_peek_id_full (GstEbmlRead * ebml, guint32 * id, guint64 * length,
guint * prefix)
{
GstFlowReturn ret;
ret = gst_ebml_peek_id_length (id, length, prefix,
(GstPeekData) gst_ebml_read_peek, (gpointer) gst_ebml_read_br (ebml),
ebml->el, gst_ebml_read_get_pos (ebml));
if (ret != GST_FLOW_OK)
return ret;
GST_LOG_OBJECT (ebml->el, "id 0x%x at offset 0x%" G_GINT64_MODIFIER "x"
" of length %" G_GUINT64_FORMAT ", prefix %d", *id,
gst_ebml_read_get_pos (ebml), *length, *prefix);
Now see the 4:th argument to gst_ebml_peek_id_length () is
(GstPeekData) gst_ebml_read_peek
where gst_ebml_read_peek is another function whose definition is:
static const guint8 *
gst_ebml_read_peek (GstByteReader * br, guint peek)
{
const guint8 *data = NULL;
if (G_LIKELY (gst_byte_reader_peek_data (br, peek, &data)))
return data;
else
return NULL;
}
Now I want to ask you is: gst_ebml_read_peek has two input argument in definition, so how can it be called (in the upper code) without arguments?
Edit:
You can find this code at
http://gstreamer.freedesktop.org/data/coverage/lcov/gst-plugins-good/gst/matroska/ebml-read.c.gcov.html
From around line 194.
Here is a simpler example doing a similar thing:
The
print_resultfunction takes another function as a parameter, which it then calls. When you just writeaddwithout the parentheses, the function is not yet called. It is only called in a function call expression, and that looks like this:function_name(arguments).