Is it ok to pass &my_boost_array_variable[2] into a C function expecting a Type*
Hi,
I have a two variables:
boost::array my_boost_array_variable_1
AMDG On 11/29/2012 01:47 AM, Anton Daneyko wrote:
Hi, I have a two variables: boost::array my_boost_array_variable_1
; boost::array my_boost_array_variable_2 ; now I want to call a C function with the following signature: int MPI_Allreduce ( void *sendbuf, void *recvbuf, ...);
I want to pass the address of a particular element of my my_boost_array_variable_1 and my_boost_array_variable_2 as a first and second parameter of MPI_Allreduce: MPI_Allreduce(&my_boost_array_variable_1[2], &my_boost_array_variable_2[2], ...
Yes, this is legal. A pointer is a pointer, regardless of how you get it and all of the intermediate expressions are legal too.
or should I rather do: MPI_Allreduce(my_boost_array_variable_1.c_array() + 2, my_boost_array_variable_2.c_array() + 2, ...
In Christ, Steven Watanabe
participants (2)
-
Anton Daneyko
-
Steven Watanabe