- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我开始使用boost的序列化代码将数据写入二进制流。我收到以下可以禁用的警告 (D_SCL_SECURE_NO_WARNINGS
),但我想知道这样做是否安全?我怎样才能获得更具体的信息,我的哪些代码导致了警告?我只知道 .cpp 文件。
这是 Visual Studio 2008 的输出:
4>g:\winlib\boost\1_42_0\boost/archive/basic_binary_iprimitive.hpp(162) : warng C4996: 'std::basic_streambuf<_Elem,_Traits>::sgetn': 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'
4> with
4> [
4> _Elem=char,
4> _Traits=std::char_traits<char>
4> ]
4> E:\Visual Studio 9.0\VC\include\streambuf(121) : see declaration of 'std::basic_streambuf<_Elem,_Traits>::sgetn'
4> with
4> [
4> _Elem=char,
4> _Traits=std::char_traits<char>
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/basic_binary_iprimitive.hpp(152) : while compiling class template member function 'void boost::archive::basic_binary_iprimitive<Archive,Elem,Tr>::load_binary(void *,size_t)'
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> Elem=char,
4> Tr=std::char_traits<char>
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/iserializer.hpp(107) : see reference to function template instantiation 'void boost::archive::basic_binary_iprimitive<Archive,Elem,Tr>::load<T>(T &)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> Elem=char,
4> Tr=std::char_traits<char>,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/iserializer.hpp(356) : see reference to function template instantiation 'void boost::archive::load_access::load_primitive<Archive,T>(Archive &,T &)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/iserializer.hpp(433) : see reference to function template instantiation 'void boost::archive::detail::load_non_pointer_type<Archive>::load_primitive::invoke<T>(Archive &,T &)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/iserializer.hpp(580) : see reference to function template instantiation 'void boost::archive::detail::load_non_pointer_type<Archive>::invoke<T>(Archive &,T &)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/common_iarchive.hpp(68) : see reference to function template instantiation 'void boost::archive::load<Archive,T>(Archive &,T &)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/basic_binary_iarchive.hpp(67) : see reference to function template instantiation 'void boost::archive::detail::common_iarchive<Archive>::load_override<T>(T &,int)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/binary_iarchive_impl.hpp(50) : see reference to function template instantiation 'void boost::archive::basic_binary_iarchive<Archive>::load_override<T>(T &,int)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/interface_iarchive.hpp(61) : see reference to function template instantiation 'void boost::archive::binary_iarchive_impl<Archive,Elem,Tr>::load_override<T>(T &,int)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> Elem=char,
4> Tr=std::char_traits<char>,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/basic_binary_iarchive.hpp(77) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator >><unsigned char>(T &)' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/basic_binary_iarchive.hpp(74) : while compiling class template member function 'void boost::archive::basic_binary_iarchive<Archive>::load_override(boost::archive::version_type &,int)'
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/binary_iarchive_impl.hpp(36) : see reference to class template instantiation 'boost::archive::basic_binary_iarchive<Archive>' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/binary_iarchive.hpp(42) : see reference to class template instantiation 'boost::archive::binary_iarchive_impl<Archive,Elem,Tr>' being compiled
4> with
4> [
4> Archive=boost::archive::naked_binary_iarchive,
4> Elem=char,
4> Tr=std::char_traits<char>
4> ]
4>g:\winlib\boost\1_42_0\boost/archive/basic_binary_iprimitive.hpp(176) : warning C4996: 'std::basic_streambuf<_Elem,_Traits>::sgetn': 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'
4> with
4> [
4> _Elem=char,
4> _Traits=std::char_traits<char>
4> ]
4> E:\Visual Studio 9.0\VC\include\streambuf(121) : see declaration of 'std::basic_streambuf<_Elem,_Traits>::sgetn'
4> with
4> [
4> _Elem=char,
4> _Traits=std::char_traits<char>
4> ]
4>g:\winlib\boost\1_42_0\boost/archive/basic_binary_iprimitive.hpp(162) : warning C4996: 'std::basic_streambuf<_Elem,_Traits>::sgetn': 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'
4> with
4> [
4> _Elem=char,
4> _Traits=std::char_traits<char>
4> ]
4> E:\Visual Studio 9.0\VC\include\streambuf(121) : see declaration of 'std::basic_streambuf<_Elem,_Traits>::sgetn'
4> with
4> [
4> _Elem=char,
4> _Traits=std::char_traits<char>
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/basic_binary_iprimitive.hpp(152) : while compiling class template member function 'void boost::archive::basic_binary_iprimitive<Archive,Elem,Tr>::load_binary(void *,size_t)'
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> Elem=char,
4> Tr=std::char_traits<char>
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/iserializer.hpp(107) : see reference to function template instantiation 'void boost::archive::basic_binary_iprimitive<Archive,Elem,Tr>::load<T>(T &)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> Elem=char,
4> Tr=std::char_traits<char>,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/iserializer.hpp(356) : see reference to function template instantiation 'void boost::archive::load_access::load_primitive<Archive,T>(Archive &,T &)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/iserializer.hpp(433) : see reference to function template instantiation 'void boost::archive::detail::load_non_pointer_type<Archive>::load_primitive::invoke<T>(Archive &,T &)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/iserializer.hpp(580) : see reference to function template instantiation 'void boost::archive::detail::load_non_pointer_type<Archive>::invoke<T>(Archive &,T &)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/common_iarchive.hpp(68) : see reference to function template instantiation 'void boost::archive::load<Archive,T>(Archive &,T &)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/basic_binary_iarchive.hpp(67) : see reference to function template instantiation 'void boost::archive::detail::common_iarchive<Archive>::load_override<T>(T &,int)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/binary_iarchive_impl.hpp(50) : see reference to function template instantiation 'void boost::archive::basic_binary_iarchive<Archive>::load_override<T>(T &,int)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/detail/interface_iarchive.hpp(61) : see reference to function template instantiation 'void boost::archive::binary_iarchive_impl<Archive,Elem,Tr>::load_override<T>(T &,int)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> Elem=char,
4> Tr=std::char_traits<char>,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/basic_binary_iarchive.hpp(77) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator >><unsigned char>(T &)' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> T=unsigned char
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/basic_binary_iarchive.hpp(74) : while compiling class template member function 'void boost::archive::basic_binary_iarchive<Archive>::load_override(boost::archive::version_type &,int)'
4> with
4> [
4> Archive=boost::archive::binary_iarchive
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/binary_iarchive_impl.hpp(36) : see reference to class template instantiation 'boost::archive::basic_binary_iarchive<Archive>' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive
4> ]
4> g:\winlib\boost\1_42_0\boost/archive/binary_iarchive.hpp(76) : see reference to class template instantiation 'boost::archive::binary_iarchive_impl<Archive,Elem,Tr>' being compiled
4> with
4> [
4> Archive=boost::archive::binary_iarchive,
4> Elem=char,
4> Tr=std::char_traits<char>
4> ]
4>g:\winlib\boost\1_42_0\boost/archive/basic_binary_iprimitive.hpp(176) : warning C4996: 'std::basic_streambuf<_Elem,_Traits>::sgetn': 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'
4> with
4> [
4> _Elem=char,
4> _Traits=std::char_traits<char>
4> ]
4> E:\Visual Studio 9.0\VC\include\streambuf(121) : see declaration of 'std::basic_streambuf<_Elem,_Traits>::sgetn'
4> with
4> [
4> _Elem=char,
4> _Traits=std::char_traits<char>
4> ]
谢谢!
最佳答案
如果您相信 Boost 不会传递超出范围的参数,您可以禁用警告。
Microsoft 为 C 库提出了一组新的“更安全”的函数,
http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1225.pdf
并警告所有使用旧版本的人。
您也许还可以尝试更新的 Boost 库?最新的是1.46.1
关于c++ - boost 序列化: safe to ignore warning?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5457323/
warnings.warn() 和有什么区别?和 logging.warn()就它们的作用和应该如何使用而言? 最佳答案 我同意另一个答案——logging 用于记录,warning 用于警告——但我
这是我写的代码: #usr/bin/python3 import warnings def tt(): warnings.warn("123") return 10 x = tt()
我正在尝试使用基于文档中显示的示例的代码片段来提出DeprecationWarning。 http://docs.python.org/2/library/warnings.html#warnings
我正在尝试提出一个 DeprecationWarning,其中包含基于文档中显示的示例的代码片段。 http://docs.python.org/2/library/warnings.html#war
我有兴趣尝试在调用时操纵警告,而无需围绕方法创建支持基础设施。也就是说,我需要能够捕获警告,而无需使用以下代码包装代码: tryCatch(..., warning = function() { ac
我是 js 我正在尝试使用 this.setState({但我收到警告。 你们能告诉我为什么我收到以下警告吗 warning.js:45 警告:setState(...):只能更新已安装或正在安装的组
我的最小例子是 #!/usr/bin/python3 import warnings warnings.warn('Run Forest run!', stacklevel=2) warnings.w
本文整理了Java中com.ibm.wala.util.warnings.Warnings.asString()方法的一些代码示例,展示了Warnings.asString()的具体用法。这些代码示例
本文整理了Java中com.ibm.wala.util.warnings.Warnings.clear()方法的一些代码示例,展示了Warnings.clear()的具体用法。这些代码示例主要来源于G
本文整理了Java中com.ibm.wala.util.warnings.Warnings.add()方法的一些代码示例,展示了Warnings.add()的具体用法。这些代码示例主要来源于Githu
我一定是错误地理解了警告文档。我读它的方式,这段代码: use warnings; use warnings FATAL => 'all'; warnings::warn('numeric', 'bl
我在 Linux 上使用 OpenMP 指令编译 C 代码时收到此警告: warning: ignoring #pragma omp parallel Gcc 版本是 4.4。 这只是一个我不应该关心
我有一个奇怪的 g++ 行为,当显示任何其他警告时,它会显示有关无法识别的命令行选项的警告。 例子: struct Foo{virtual int bar() = 0;}; struct Bar:pu
在 Visual Studio 2010 中使用 C++ native 解决方案。 #pragma warning (push) 用于 cpp 文件的开头,在所有包含之后。之后,#pragma war
我习惯于开始我的每一个脚本 use strict; use warnings; 但是这里的一些知名人士推荐 use warnings 'all'; 如果我理解正确,后者甚至比第一个更好。所以我通读了d
我正在编码C#。我使用NCrunch在后台运行单元测试。我已经在CSPROJ文件中设置了(新的CSPROJ格式)。 我想将FxCop分析仪用作NuGet软件包:https://docs.microso
谁能帮我解决这个问题,我收到此警告消息 log4j:WARN No appenders could be found for logger (com.akak.book.shop.listener.L
我正在尝试了解更多关于 linux 内核中的 kobject 的信息,并且在尝试编写一个使用此类工具的模块时,我收到了错误和警告消息,因此我将相关数据的精简版本放在这里结构和相应的gcc的错误和警告信
http://docs.python.org/2/howto/logging.html 上的样本同时使用 warn 和 warning。 最佳答案 logging.warn 自 Python 3.3
警告[nuxt]两个解析为相同名称ProseCode的组件文件:。警告[nuxt]两个解析为相同名称ProsePre的组件文件:。更新nuxt 3后的警告->3.7&nuxt/内容2.4->2.8。如
我是一名优秀的程序员,十分优秀!