From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22537 invoked by alias); 1 Oct 2002 01:46:12 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 22526 invoked from network); 1 Oct 2002 01:46:08 -0000 Received: from unknown (HELO wh2-19.st.uni-magdeburg.de) (141.44.162.19) by sources.redhat.com with SMTP; 1 Oct 2002 01:46:08 -0000 Received: by wh2-19.st.uni-magdeburg.de (Postfix, from userid 1000) id D99DB90F60; Tue, 1 Oct 2002 03:40:39 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15768.64790.672106.560515@wh2-19.st.uni-magdeburg.de> Date: Mon, 30 Sep 2002 18:46:00 -0000 From: "Claudio Bley" To: "Jason Mancini" Cc: gcc-help@gcc.gnu.org Subject: RE: How to pass 2D variable-sized arrays in C++? In-Reply-To: References: X-SW-Source: 2002-09/txt/msg00235.txt.bz2 >>>>> "Jason" == Jason Mancini 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 / \