I really don't want to go that far. I already had to deal with the
bool to int conversion in exactly this way. And changing it all over
the code, was a mess. As the simple explicit cast is enough to keep
happy the VC compiler, I propose we stick with it. It's less
intrusive, impose less [unusual] things to the developers, and still
give us the benefit of allowing Open MPI to get compiled on Windows.
On Apr 18, 2007, at 4:13 PM, Roland Dreier wrote:
>> 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)
> #define ompi_cast_to_int(x) (x)
> intval = ompi_cast_to_int(stroul(foo));
> Right? ;)
> - R.
> devel mailing list
- application/pkcs7-signature attachment: smime.p7s