Why are vectors not arrays?

Ian Lance Taylor ian@wasabisystems.com
Fri Apr 9 14:30:00 GMT 2004


This may be a dumb question, but why doesn't this work?

typedef int v2si __attribute__ ((vector_size (8)));
int foo (v2si v) { return v[0]; }

I get:

foo2.c: In function `foo':
foo2.c:2: error: subscripted value is neither array nor pointer

We have vector extensions which support addition, subtraction, and so
forth, which is great, but is there any simple way to actually get
values in and out of vectors?  The documentation appears to be silent
on the matter.

Ian



More information about the Gcc mailing list