This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: How to pass 2D variable-sized arrays in C++?


>>>>> "Jason" == Jason Mancini <jayrusman@hotmail.com> writes:

    Jason> Hi again, After many tries, I propose that this is the
    Jason> "correct solution".  The compiler should hide the address
    Jason> calculation for me -- this is why we have compilers after
    Jason> all!  Thanks, Jason Mancini


    Jason> void func(int c, int r, float *fa) { 
    Jason>    float (*f)[c] = (float (*)[c])fa;
    Jason>    ... f[xr][xc] ... }

Yeah, this is cool. I didn't know this is possible. The drawback is
that it might not work with any other compiler out there except
gcc. (I can confirm it doesn't work with Intel's C++ compiler for
example)

I myself wouldn't use such esoteric features (if it really is one -
maybe Intel's compiler is just faulty?). I would like to see some
reference to the standard spec where this is defined.

Cheers
-- 
Claudio Bley                                 ASCII ribbon campaign (")
Debian GNU/Linux advocate                     - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]