Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Roland Dreier (rdreier_at_[hidden])
Date: 2007-04-18 16:13:11


> The main problem came from the fact that if we want to use our
> modular approach on Windows (DLL loaded at runtime) we have to
> compile in C++ mode. The C++ compiler consider the types int and long
> as being different (even if they have the same number of bytes). No
> implicit cast is allowed by the VC compiler when in C++ mode.
> Therefore, we have to force an explicit cast everywhere.

I see... so the right way to right this is really:

        #ifdef __cplusplus
        #define ompi_cast_to_int(x) static_cast<int>(x)
        #else
        #define ompi_cast_to_int(x) (x)
        #endif
        
                intval = ompi_cast_to_int(stroul(foo));

Right? ;)

 - R.