[music-dsp] function pointers

Jeffrey Traer Bernstein jeffyb at ccrma.stanford.edu
Mon Oct 20 11:47:00 EDT 2003


Function pointers are C. In C++, polymorphism in the form of virtual 
functions is the Object Oriented way to do things. If you really want to 
go functors it's more robust and extensible to use polymorphism and 
redefine the function call operator ( operator() ) then to use function 
pointers...

Martin C. Martin wrote:

>
>
> Tim Place wrote:
>
>> Hi all,
>>
>> It may be compounded by the fact that I'm in C++ rather than C, and 
>> I'm trying to do this so that the correct member function is called 
>> from outside. 
>
>
> In C++, virtual functions take the place of most uses of function 
> pointers.  Does your DSP support virtual functions?  Can you express 
> the interface as a base class, and the actual implementations as 
> derived classes?
>
> (The situation is analogous to for loops, while loops and if 
> statements taking the place of most goto statements.)
>
> - Martin
>
> dupswapdrop -- the music-dsp mailing list and website: subscription 
> info, FAQ, source code archive, list archive, book reviews, dsp links 
> http://shoko.calarts.edu/musicdsp 
> http://ceait.calarts.edu/mailman/listinfo/music-dsp





More information about the music-dsp mailing list