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 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 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.

Stefan Nitschke wrote:

are different versions of gcc3 ABI - compatible?
AFAIK all versions of gcc3 except version 3.0 which had a bug are compatible.
Starting gcc 3.2, they changed the ABI again, so g++ 3.2 produces incompatible code with 3.1, 3.0, etc. I hope the gcc 3.2 ABI will remain stable ever after.

liulk


Reply via email to