On Mon, Dec 14, 2009 at 8:19 PM, Greg Ewing <[email protected]> wrote:
> Lisandro Dalcín wrote:
>
>> Greg, please tell me, what could go wrong with accepting external
>> definition for except clauses? I cannot imagine any potential issue,
>> but your "resistance" to my use case makes my think that you have some
>> concerns about my request...
>
> You misunderstand -- I'm not resisting, I'm just
> suggesting ways in which you could work around the
> problem in the meantime.
>

OK. Sorry!

> Your point about type checking is a valid one. There
> would still be some protection, since the C compiler
> will complain if you misuse the type, but I agree
> it's not an ideal situation.
>

Well, not always! ... MPICH2 (a MPI implementation), does this:

$ grep 'typedef int MPI_' /usr/local/mpich2/include/mpi.h
typedef int MPI_Datatype;
typedef int MPI_Comm;
typedef int MPI_Group;
typedef int MPI_Win;
typedef int MPI_Op;
typedef int MPI_Errhandler;
typedef int MPI_Request;
typedef int MPI_Info;
typedef int MPI_Fint;

So the C compiler sees all the opaque types as an 'int' ... Then you
do not get any actual type-checking from the C compiler ...

So, for this call:

int MPI_Isend(void*, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *);

I can write the code below, and it compiles without any single
warning... but that code is actually broken...

#include <mpi.h>
int main( int argc, char ** argv ) {
  int a=0,b=0,c=0,d=0,e=0,f=0;
  MPI_Isend(0,a, b, c, d, e, &f);
  return 0;
}

Fortunately, telling Cython that MPI_Comm, MPI_Datatype, and
MPI_Request are pointers to incomplete structs saves me for the lack
of type-checking in C land.


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to