Coding DSP perform routines in plain C


Recently I have been away from C++, cos i needed to write a Pure Data external in plain old C. At first i was kind of dreading it, thinking i’d struggle with C after having all the nice things Juce and C++ offer. But actually, i really got into it, and to be honest, i found myself enjoying the restraints and simplicity of C in that case.
Also, i can put my DSP code inside pd externals and check it very thoroughly there.

So, my question: if i enjoy writing my DSP processing in plain C, and i have a good system going with that… are there any really overwhelming reasons i shouldn’t?
I am certainly using C++ for the overall framework of my projects, but just for those critical bits of audio code, i’m really finding C is working well.

Is this ok to mix and match?


What's the difference? If you put a bunch of C code in the middle of a C++ class, then nobody would know!


(Almost) all C code will compile and run just fine in C++ with no need to change. But whenever you need the C++ goodness, you can use it too... for example STL algorithms (e.g. std::sort is way faster than C's qsort), which also works great with plain C arrays, and template metaprogramming, which allows you to write even faster code in many cases.


Awesome! For sure this is the way i will do it then.