help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

2d VLA argument, void f( int m, int n, int a[m][n] ) ?


From: denis
Subject: 2d VLA argument, void f( int m, int n, int a[m][n] ) ?
Date: Mon, 10 Aug 2009 04:29:30 -0700 (PDT)
User-agent: G2/1.0

Folks,
  how can I pass a 2d array with sizes, like

void f( int m, int n, int a[m][n] )
{
    ... a[j][k] = ...
?
I see claims that this is valid C99, but g++-4.2.1 gives
    error: ‘m’ was not declared in this scope

So, how can I make this work ?
I don't care much about the function header or call syntax,
but a[j][k] in the body should work as fast as a[j*n+k] .
(Some suggest boost::multi_array -- anyone have an example of such an f
() with that ?)

cheers
  -- denis


reply via email to

[Prev in Thread] Current Thread [Next in Thread]