[PD] C++ for reusable dsp lib - or better use C?
Mathieu Bouchard
matju at artengine.ca
Sun Mar 4 16:26:26 CET 2012
Le 2012-03-04 à 03:10:00, Billy Stiltner a écrit :
> What we need is flat address space without the overhead of GDS segment
> sorcery.
What's GDS ? Is that a Windows-only thing ?
> It's pretty bad to be able to delete a list of a list of pointers to
> objects that deletes itself before it deletes itself in a polymorphic
> virtual destructor. ;)
Any language with sufficient power will have to allow the user to screw
up. C gives you the power to decide of your own allocation duration (after
malloc, how long before you free). But C also gives you the power to write
your own automatic-free, or use someone else's. C++ makes it easier in
some ways (ref-counting can become almost completely implicit).
> C++ is great but it is much easier to keep up with pointers in c.
Please don't make it look like you didn't try C++ ;) In C++ you have a
larger number of constructs you can use ; in C you have to reuse the same
constructs in more different ways before you can get to the same solution.
Any C++ programme could have been written using C by the means of more
funny tricks and longer, more redundant code. The length and redundancy is
sometimes all it takes to make bugs harder to find.
> c is just like c++ without the confusion you can work yourself into a
> pointer to a function is a pointer to a function
I can't parse your sentence... sorry
> and if yo look at the assembly language there aint nothing wrong with
> using struct instead of class.
In C++, struct and class are near-synonymous. All the OOP features are
available with the struct keyword. In fact, you never need the class
keyword, if you don't want it to appear in your source code.
> it's all code an data when its running.
Even when not running, if you ask me...
> the differences in the output are going to be more than likely caused by
> leaky capacitors and noisy fans or 2 coils of wire too close together.
The differences in the output between asm, C and C++ is more likely going
to be about which categories of bugs, in which amounts, will be found
between the chair and the keyboard.
And I'm not talking about Cimex Lectularius.
______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC
More information about the Pd-list
mailing list