[gst-devel] handoff calling C++ object member function

Mathrick mnews2 at wp.pl
Fri Jan 9 10:36:11 CET 2004


W liście z pią, 09-01-2004, godz. 18:54, Quan Nguyen pisze: 
> Actually, I don't know why callbacks are declared static.  Are there
> any online resources that I can use to find additional information
> regarding this?  Thanks.

static wrt. to function means it will be linked internally, i.e. won't
be visible oustide file it's defined in. That means you can have:

[ foo.c ]

static void do_something(Cookie *cookie) 
{
  eat(cookie);
}

[ bar.c ]

static void do_something(Cookie *cookie) 
{
  give(cookie);
}

and there will be no name conflict (of course only code from respective
.c files can access static functions). This useful for preventing name
clashes and global namespace cluttering, and thus should be used for
your internal functions that don't need to be visible outside.
Note also this is not true for class member functions in C++, and means
something different in that context.
I'd suggest reading good C book (K&R is the best, and very
comprehensible) and / or C++ one (here Stroustrup is enlightening,
although demanding lecture) where you will have similar details
explained.

-- 
"Tautologizm to coś tautologicznego"
   Maciej Katafiasz <mnews2 at wp.pl>
       http://mathrick.blog.pl





More information about the gstreamer-devel mailing list