草庐IT

GL_UNSIGNED_SHORT

全部标签

c++ - 关于 unsigned int 的建议(江南 Style 版)

“江南style”视频(我相信你一定听说过)在youtube上的浏览​​量刚刚超过20亿。事实上,谷歌表示他们从未期望视频大于32位整数......这暗示了谷歌使用int而不是unsigned的事实他们的观点柜台。我认为他们不得不重新编写代码以适应更大的View。查看他们的风格指南:https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Integer_Types...他们建议“不要使用无符号整数类型”,并给出一个很好的理由:unsigned可能是错误的。这是一个很好的理由,但可以提防。我的问题是:通常使用uns

c++ - 警告 C4244 : 'argument' : conversion from 'time_t' to 'unsigned int' , 可能丢失数据 -- C++

我制作了一个简单的程序,允许用户选择一些骰子然后猜测结果......我之前发布了这段代码,但有错误的问题,所以它被删除了......现在我不能有任何错误甚至此代码上的警告,但由于某种原因,此警告不断弹出,我不知道如何修复它...“警告C4244:'argument':从'time_t'转换为'unsignedint',可能丢失数据”#include#include#include#includeusingnamespacestd;intchoice,dice,random;intmain(){stringdecision;srand(time(NULL));while(decision

c++ - 警告 C4244 : 'argument' : conversion from 'time_t' to 'unsigned int' , 可能丢失数据 -- C++

我制作了一个简单的程序,允许用户选择一些骰子然后猜测结果......我之前发布了这段代码,但有错误的问题,所以它被删除了......现在我不能有任何错误甚至此代码上的警告,但由于某种原因,此警告不断弹出,我不知道如何修复它...“警告C4244:'argument':从'time_t'转换为'unsignedint',可能丢失数据”#include#include#include#includeusingnamespacestd;intchoice,dice,random;intmain(){stringdecision;srand(time(NULL));while(decision

c++ - 是否应该通过 std::cin 将负数读入 unsigned 失败(gcc,clang 不同意)?

例如,#includeintmain(){unsignedn{};std::cin>>n;std::cout输入-1时,clang6.0.0输出00而gcc7.2.0输出42949672951。我想知道谁是正确的。或者也许两者都是正确的标准没有指定这一点?如果失败,我的意思是(bool)std::cin被评估为假。clang6.0.0也无法输入-0。从Clang9.0.0和GCC9.2.0开始,在Clang的情况下使用libstdc++或libc++的两个编译器都同意上述程序的结果,与C++版本无关(>=C++11)使用并打印42949672951即他们将值设置为ULLONG_MAX并

c++ - 是否应该通过 std::cin 将负数读入 unsigned 失败(gcc,clang 不同意)?

例如,#includeintmain(){unsignedn{};std::cin>>n;std::cout输入-1时,clang6.0.0输出00而gcc7.2.0输出42949672951。我想知道谁是正确的。或者也许两者都是正确的标准没有指定这一点?如果失败,我的意思是(bool)std::cin被评估为假。clang6.0.0也无法输入-0。从Clang9.0.0和GCC9.2.0开始,在Clang的情况下使用libstdc++或libc++的两个编译器都同意上述程序的结果,与C++版本无关(>=C++11)使用并打印42949672951即他们将值设置为ULLONG_MAX并

c++ - 无法初始化 GLEW。缺少 GL 版本

已结束。此问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭去年。Improvethisquestion我尝试使用最新版本的qtcreator设置SFML2.0,我已经正确设置了SFML,并导入了我在VisualStudio中编写的一个小游戏。编译后,我得到了这个:我尝试了什么从头开始重新安装整个qtSDK和qtcreatorIDE重新安装SFML重新安装m

c++ - 无法初始化 GLEW。缺少 GL 版本

已结束。此问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭去年。Improvethisquestion我尝试使用最新版本的qtcreator设置SFML2.0,我已经正确设置了SFML,并导入了我在VisualStudio中编写的一个小游戏。编译后,我得到了这个:我尝试了什么从头开始重新安装整个qtSDK和qtcreatorIDE重新安装SFML重新安装m

c++ - 对 boost::gregorian::greg_month::as_short_string() const 的 undefined reference

这被问了好几次,但我不知道我做错了什么。我正在尝试将当前日期减去7。这是主要的:#include#include#include#includeusingnamespacestd;usingnamespaceboost::gregorian;intmain(intargc,char**argv){time_trawtime;structtm*timeinfo;time(&rawtime);timeinfo=localtime(&rawtime);datecdate(timeinfo->tm_year+1900,timeinfo->tm_mon+1,timeinfo->tm_mday);

c++ - 对 boost::gregorian::greg_month::as_short_string() const 的 undefined reference

这被问了好几次,但我不知道我做错了什么。我正在尝试将当前日期减去7。这是主要的:#include#include#include#includeusingnamespacestd;usingnamespaceboost::gregorian;intmain(intargc,char**argv){time_trawtime;structtm*timeinfo;time(&rawtime);timeinfo=localtime(&rawtime);datecdate(timeinfo->tm_year+1900,timeinfo->tm_mon+1,timeinfo->tm_mday);

c++ - 为什么 shared_ptr<T>::use_count() 返回 long 而不是 unsigned 类型?

shared_ptr观察者20.8.2.2.5C++14最终草案(n4296)longuse_count()constnoexcept;Returns:thenumberofshared_ptrobjects,*thisincluded,thatshareownershipwith*this,or0when*thisisempty.[Note:use_count()isnotnecessarilyefficient.—endnote] 最佳答案 根据这个页面http://www.open-std.org/jtc1/sc22/wg21