[linux-audio-dev] soft synth as a plugin
STEFFL, ERIK (SBCSI)
es6269 at sbc.com
Sun Oct 20 15:27:00 UTC 2002
-----Original Message-----
> From: Likai Liu
> To: linux-audio-dev at music.columbia.edu
> Sent: 10/19/02 1:42 PM
> Subject: Re: [linux-audio-dev] soft synth as a plugin
>
> STEFFL, ERIK (SBCSI) wrote:
>
> >>erm, sorry, but why not use pointers
> >>
> > it's dangerous... null pointers, memory leaks etc. tendency is not to
> use
> >pointers unless absolutely neccessary...
> >
> References in C++ are just pointers in a sugared form. Actually they are
EVERYTHING in ALL computer languages is just sugar, all these languages
(the turing complete ones) are same, apart from syntactic sugar. so your
statement doesn't really say anything.
> the same thing in a slightly different syntax. There is no memory safety
>
> in C/C++, so you end up having the same risks no matter you use pointers
no you don't. just because it's still risky doesn't mean it is the SAME.
C++ is quite unsafe as far as memory management goes but certain practices
can lead to memory mismanagement much easier - one of the practices that can
help is using references instead of pointers.
when using references it's quite hard (=harder then when using pointers)
to:
free already free-ed memory
create NULL reference
have a memory leak
> or references. The difference of the performance probably lies in the
> fact that the compiler understands your code better with references,
> hence it can do better optimizations. My guess is that references are
> easier to optimize against because you don't do pointer arithmetics and
> pointer type-casting on references.
I don't believe there is performance difference. is there anything that
suggests there is?
erik
More information about the Linux-audio-dev
mailing list