<div dir="ltr">Folks, I know we have had this function for a long time, and I've implemented ports of MPI that actually use it (e.g., with pre-pinned memory). But, I am trying to understand the logic for why baseptr is passed by value, instead of by reference. In C, everything is by value, so the last argument in normal C programs would be void **baseptr. <div><br></div><div>The standard has:<br clear="all"><div><pre style="color:rgb(0,0,0)">int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr);</pre><pre style="color:rgb(0,0,0)">Now, MPICC/GCC takes this with </pre><pre style="color:rgb(0,0,0)"><span style="font-family:Arial,Helvetica,sans-serif">void *memory = (void *)0;</span><br></pre><pre style="color:rgb(0,0,0)"><pre>int error = MPI_Alloc_mem(1024, MPI_INFO_NULL, &memory);</pre><pre>and you get the memory allocated properly.</pre><pre>What is more, this is incorrect:</pre><pre>int error = MPI_Alloc_mem(1024, MPI_INFO_NULL, memory);<pre></pre></pre><pre></pre></pre><pre style="color:rgb(0,0,0)">although it compiles fine because that is, indeed, the API.</pre><pre style="color:rgb(0,0,0)">Why would we have the pointer going in by value, when it is coming out
as an OUT argument?</pre><pre style="color:rgb(0,0,0)">Isn't this plain wrong? void **baseptr means ---> I am passing you the </pre><pre style="color:rgb(0,0,0)">address of a void pointer.</pre><pre style="color:rgb(0,0,0)">Every viable implementation must do *(void **)baseptr = ...</pre><pre style="color:rgb(0,0,0)">when providing the "malloc'd/special" memory. So... why did we fudge </pre><pre style="color:rgb(0,0,0)">the C API. Is there some tie-in with the Fortran API?</pre><pre style="color:rgb(0,0,0)">Thanks in advance,</pre><pre style="color:rgb(0,0,0)">Tony Skjellum</pre><pre style="color:rgb(0,0,0)"><br></pre><pre style="color:rgb(0,0,0)"><br></pre></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Anthony Skjellum, PhD<br><a href="mailto:skjellum@gmail.com" target="_blank">skjellum@gmail.com</a><br>Cell: +1-205-807-4968<div><br><div><br></div></div></div></div></div></div>