Boost logo

Boost-MPI :

Subject: Re: [Boost-mpi] _SCL_SECURE_NO_WARNINGS
From: Alain Miniussi (alain.miniussi_at_[hidden])
Date: 2015-05-25 13:55:19


Thanks,

Wouln't it be possible to only add the magic in boost/mpi/config.hpp ?
(which is supposed to be included everywhere in boost MPI)

Maybe something along the line of:
#ifdef BOOST_MSVC
#define _SCL_SECURE_NO_WARNINGS
#endif

?

On 25/05/2015 18:21, Thomas Trummer wrote:
>
>> On 25.05.2015, at 17:52, Alain Miniussi <alain.miniussi_at_oca.eu> wrote:
>>
>> Just out of curiosity (I do not have access Microsoft Compiler) what are these warnings about ?
>
> Ten years ago Microsoft identified C and C++ library functions that are prone to security problems like buffer overruns (e.g. strcpy) and provided secure alternatives. The compiler will warn you when you use an old, insecure function. While this is in general not a bad idea it’s also inherently not portable: https://msdn.microsoft.com/en-us/library/8ef0s5kh.aspx
>
> Here is an example of a warning:
>
> all_gather_test.cpp
> ..\libs\mpi\test\all_gather_test.cpp(67) : warning C4305: 'argument' : truncation from 'double' to 'float'
> C:\Programme\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(2227) : warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
> C:\Programme\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(2212) : see declaration of 'std::_Copy_impl'
> C:\boost\develop\boost_root\boost/mpi/collectives/gather.hpp(65) : see reference to function template instantiation '_OutIt std::copy<const T*,T*>(_InIt,_InIt,_OutIt)' being compiled
> with
> [
> _OutIt=value_type *,
> T=value_type,
> _InIt=const value_type *
> ]
> C:\boost\develop\boost_root\boost/mpi/collectives/gather.hpp(124) : see reference to function template instantiation 'void boost::mpi::detail::gather_impl<T>(const boost::mpi::communicator &,const T *,int,T *,int,boost::mpl::false_)' being compiled
> with
> [
> T=value_type
> ]
> C:\boost\develop\boost_root\boost/mpi/collectives/all_gather.hpp(43) : see reference to function template instantiation 'void boost::mpi::gather<T>(const boost::mpi::communicator &,const T *,int,T *,int)' being compiled
> with
> [
> T=value_type
> ]
> C:\boost\develop\boost_root\boost/mpi/collectives/all_gather.hpp(68) : see reference to function template instantiation 'void boost::mpi::detail::all_gather_impl<T>(const boost::mpi::communicator &,const T *,int,T *,boost::mpl::false_)' being compiled
> with
> [
> T=value_type
> ]
> C:\boost\develop\boost_root\boost/mpi/collectives/all_gather.hpp(61) : see reference to function template instantiation 'void boost::mpi::all_gather<T>(const boost::mpi::communicator &,const T *,int,T *)' being compiled
> with
> [
> T=value_type
> ]
> ..\libs\mpi\test\all_gather_test.cpp(40) : see reference to function template instantiation 'void boost::mpi::all_gather<value_type>(const boost::mpi::communicator &,const T &,std::vector<_Ty> &)' being compiled
> with
> [
> T=value_type,
> _Ty=value_type
> ]
> ..\libs\mpi\test\all_gather_test.cpp(105) : see reference to function template instantiation 'void all_gather_test<string_generator>(const boost::mpi::communicator &,Generator,const char *)' being compiled
> with
> [
> Generator=string_generator
> ]
> C:\Programme\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(2227) : warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
> C:\Programme\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(2212) : see declaration of 'std::_Copy_impl'
> C:\boost\develop\boost_root\boost/mpi/collectives/gather.hpp(65) : see reference to function template instantiation '_OutIt std::copy<const T*,T*>(_InIt,_InIt,_OutIt)' being compiled
> with
> [
> _OutIt=value_type *,
> T=value_type,
> _InIt=const value_type *
> ]
> C:\boost\develop\boost_root\boost/mpi/collectives/gather.hpp(124) : see reference to function template instantiation 'void boost::mpi::detail::gather_impl<T>(const boost::mpi::communicator &,const T *,int,T *,int,boost::mpl::false_)' being compiled
> with
> [
> T=value_type
> ]
> C:\boost\develop\boost_root\boost/mpi/collectives/all_gather.hpp(43) : see reference to function template instantiation 'void boost::mpi::gather<T>(const boost::mpi::communicator &,const T *,int,T *,int)' being compiled
> with
> [
> T=value_type
> ]
> C:\boost\develop\boost_root\boost/mpi/collectives/all_gather.hpp(68) : see reference to function template instantiation 'void boost::mpi::detail::all_gather_impl<T>(const boost::mpi::communicator &,const T *,int,T *,boost::mpl::false_)' being compiled
> with
> [
> T=value_type
> ]
> C:\boost\develop\boost_root\boost/mpi/collectives/all_gather.hpp(61) : see reference to function template instantiation 'void boost::mpi::all_gather<T>(const boost::mpi::communicator &,const T *,int,T *)' being compiled
> with
> [
> T=value_type
> ]
> ..\libs\mpi\test\all_gather_test.cpp(40) : see reference to function template instantiation 'void boost::mpi::all_gather<value_type>(const boost::mpi::communicator &,const T &,std::vector<_Ty> &)' being compiled
> with
> [
> T=value_type,
> _Ty=value_type
> ]
> ..\libs\mpi\test\all_gather_test.cpp(106) : see reference to function template instantiation 'void all_gather_test<string_list_generator>(const boost::mpi::communicator &,Generator,const char *)' being compiled
> with
> [
> Generator=string_list_generator
> ]
> _______________________________________________
> Boost-mpi mailing list
> Boost-mpi_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-mpi
>

-- 
---
Alain

Boost-Commit list run by troyer at boostpro.com