This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: How to pass 2D variable-sized arrays in C++?
- From: "Claudio Bley" <bley at cs dot uni-magdeburg dot de>
- To: "Jason Mancini" <jayrusman at hotmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 1 Oct 2002 03:40:38 +0200
- Subject: RE: How to pass 2D variable-sized arrays in C++?
- References: <F18V19XxlU1IXZNwX8Z00002d5c@hotmail.com>
>>>>> "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 / \