[linux-audio-dev] [ot] [rant] gcc, you let me down one time toomany
Chris Cannam
cannam at all-day-breakfast.com
Thu Jun 9 19:23:57 UTC 2005
On Thursday 09 Jun 2005 20:07, stefan kersten wrote:
> On Thu, Jun 09, 2005 at 09:39:21PM +0300, Jussi Laako wrote:
> > On Thu, 2005-06-09 at 18:14 +0200, stefan kersten wrote:
> > > int access(std::vector<int> v, int i)
> >
> > At least you are making copy here, should be
> > int access(std::vector<int> &v, int i)
>
> actually not, structs are passed by reference.
$ cat a.cpp
#include <cassert>
struct A {
A() { }
A(const A &) { assert(0); }
};
void f(A) { }
int main(int argc, char **argv)
{
A a;
f(a);
}
$ gcc -O3 a.cpp -o a
$ ./a
a: a.cpp:5: A::A(const A&): Assertion `0' failed.
Aborted
$
More information about the Linux-audio-dev
mailing list