www.digitalmars.com         C & C++   DMDScript  

c++ - Passing reference to array

reply Christof Meerwald <cmeerw web.de> writes:
here is a test-case:

typedef char my_array[10];

void f(my_array &x)
{ }

void g(my_array &x)
{
  f(x);
// Error: need explicit cast for function parameter 1 to get
// from: char **
// to  : char (*)[10]
}
      
int main()
{
  my_array x;

  g(x);

  return 0;
}


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Nov 12 2002
parent "Matthew Wilson" <dmd synesis.com.au> writes:
For what it's worth, I just checked it, and Borland 5.5, Metrowerks 3.0,
VC++ 7 & Intel 6 all work correctly.

"Christof Meerwald" <cmeerw web.de> wrote in message
news:aqrjtq$o34$1 digitaldaemon.com...
 here is a test-case:

 typedef char my_array[10];

 void f(my_array &x)
 { }

 void g(my_array &x)
 {
   f(x);
 // Error: need explicit cast for function parameter 1 to get
 // from: char **
 // to  : char (*)[10]
 }

 int main()
 {
   my_array x;

   g(x);

   return 0;
 }


 bye, Christof

 --
 http://cmeerw.org                                 JID: cmeerw jabber.at
 mailto cmeerw at web.de

 ...and what have you contributed to the Net?
Nov 12 2002