[Mpi-forum] 2 minor corrections to ticket 140 ticket
Jeff Squyres
jsquyres at cisco.com
Fri Jul 15 14:25:23 CDT 2011
Fab just reminded me (Fab: go back to your vacation!!) that leaving const off these parameters was intentional.
The reason is that the C compiler does not know how to auto-promote non-const double pointer parameters to be const. The C++ compiler knows how to do this, which is why the C++ prototypes for GROUP_INCL and GROUP_EXCL have these parameters const-ified.
Example:
-----
[15:23] beezle:~/tmp % cat foo.c
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
void foo(const int a[][3])
{
return;
}
int main()
{
const int a[2][3] = { 0 };
int b[3][3] = { 0 };
foo(a);
foo(b); /* This is line 16 that gcc warns about */
return 0;
}
[15:23] beezle:~/tmp % gcc foo.c
foo.c: In function ‘main’:
foo.c:16: warning: passing argument 1 of ‘foo’ from incompatible pointer type
[15:23] beezle:~/tmp % g++ foo.c
[15:23] beezle:~/tmp %
-----
So we withdraw the const-ifying of these 2 functions and return to the original text that was read last meeting.
On Jul 14, 2011, at 9:17 AM, Jeff Squyres wrote:
> During chapter committee reviews, Bill found two minor "const" omissions in the PDF on ticket 140 -- we forgot the int ranges[][3] parameters in MPI_GROUP_RANGE_INCL and MPI_GROU_RANGE_EXCL on pages 219 and 220:
>
> -----
> int MPI_Group_range_incl(MPI_Group group, int n, const int ranges[][3], MPI_Group *newgroup)
>
> int MPI_Group_range_excl(MPI_Group group, int n, const int ranges[][3],
> MPI_Group *newgroup)
> -----
>
> Ticket 140 is coming up for its first vote next week in Chicago.
>
> If the Forum is amenable, I'll fix these and submit the fixed text for voting. If the Forum is not amenable, I'll submit the original text for voting and these two parameters simply won't be const-ified.
>
> --
> Jeff Squyres
> jsquyres at cisco.com
> For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/
>
--
Jeff Squyres
jsquyres at cisco.com
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/
More information about the mpi-forum
mailing list