草庐IT

arm_const_structs

全部标签

c# - 如何将带有 const char* 的 C union 映射到 C# 结构?

在本地库的回调函数中,我需要访问一个espeak_EVENT数组。问题出在原C代码中的UNION语句:typedefstruct{espeak_EVENT_TYPEtype;unsignedintunique_identifier;//messageidentifier(or0forkeyorcharacter)inttext_position;//thenumberofcharactersfromthestartofthetextintlength;//wordlength,incharacters(forespeakEVENT_WORD)intaudio_position;//th

c++ - 在 ARM 上使用 Qt 的简单程序中的段错误

我正在尝试在ARM系统上使用Qt4.7.4,以便在触摸屏上显示图形应用程序。我的ARM卡内嵌了Linux系统;我们使用Linuxframebuffer向屏幕发送信息,tslib+usbtouchscreen驱动获取触摸信息。我能够交叉编译Qt并将库放在我的系统上。但是当我启动我的测试程序时,我每次都在同一时刻遇到段错误(没有逻辑原因)。首先,这是我的测试程序(你可以看到它非常基础,没有理由出现段错误):#include#includeintmain(intargc,char*argv[]){QApplicationapp(argc,argv);QMessageBoxmsgBox;msg

c++ - 为什么 boost::call_traits<double>::param_type 是 "const double&"而不是 "double"

我在win32program@windows7机器上使用代码“boost::call_traits::param_type”。令我惊讶的是,它不是“double”而是“constdouble&”。我认为所有原始类型都适合对函数参数使用“按值传递”,这不是常识吗?因为很多人会使用is_pod来判断是否使用引用,不是吗? 最佳答案 根据doc,该优化显然只适用于“小型”内置类型。.快速浏览source,看起来“小”类型被认为是满足sizeof(T)的类型.在32位机器上,这显然不包括double.在某些情况下,将参数传递为double可

c++ - 应该如何使用 const/non-const 参数重载函数?

我有以下代码://stringspecializationsvoidfoo(constchar*a,constchar*b);voidfoo(constchar*a,conststd::string&b);voidfoo(conststd::string&a,constchar*b);voidfoo(conststd::string&a,conststd::string&b);//genericimplementationtemplatevoidfoo(TAa,TAb){...}问题是这个测试用例:chartest[]="test";foo("test",test);最终调用了foo的

c++ - std::set<K, C>::operator<(const std::set<K, C>&) 不使用 C() 但 std::less()

无法删除我自己的问题,所以改写它... 最佳答案 这实际上不是实现中的错误,尽管它可以说是标准中的错误:23.2.1Generalcontainerrequirements[container.requirements.general]13Table98listsoperationsthatareprovidedforsometypesofcontainersbutnotothers.Thosecontainersforwhichthelistedoperationsareprovidedshallimplementtheseman

c# - 组合 C# 和 C++ 项目适用于 x86 和 x64,但不适用于 ARM

我的解决方案中有两个项目。一个是C#通用应用程序,另一个是C++项目(从here获得)并重新定位到Windows8.1(这是在我导入项目时由VisualStudio15执行的)。我从我的C#项目中引用了C++项目,并将CopyLocal设置为true。代码构建完美适用于所有三个平台(x86、x64和ARM)。但是,当部署到ARM设备时,在我尝试访问C++代码的行上抛出了一个异常。在x86和x64版本上,这不是问题,代码工作得很好。异常是System.IO.FileNotFoundException和hereisapastebinoftheexceptionindetail.我对这个异常

c++ - 使用 const 引用的函数模板重载决议

我试图理解以下情况下的重载决议规则:templatevoidf(constT&x){std::coutvoidf(T&x){//ÜberladungVariante2std::cout输出是:voidf(T&)[T=int]voidf(constT&)[T=int]据我所知,第一次调用f(e1)会导致可行的功能voidf(constint&)voidf(int&)从中选择第一个,因为没有删除const限定。第二次调用f(e2)导致类型推导/可行函数voidf(constint&);//T->intfromfirsttemplateoverloadvoidf(constint&);//T

c++ - 'auto' 关键字如何知道何时使用 const_iterator 匹配函数重载?

我了解thisquestion的内容但是当使用函数重载时,事情是如何工作的呢?例如在std::map中定义了以下方法:iteratorfind(constkey_type&k);const_iteratorfind(constkey_type&k)const;如何使用auto关键字来选择一个或另一个?以下内容对我来说似乎不正确:autoi=mymap.find(key);//callsthenon-constmethod?constautoi=mymap.find(key);//callstheconstmethod? 最佳答案 s

c++ - ‘const’ 错误之前的预期主表达式

请帮忙。我收到很多错误。sub2.cpp:在函数“intmain()”中:sub2.cpp:11:14:错误:从‘constchar*’到‘char’的无效转换[-fpermissive]sub2.cpp:12:14:错误:从‘constchar*’到‘char’的无效转换[-fpermissive]sub2.cpp:16:17:错误:'const'之前需要主表达式sub2.cpp:16:36:错误:'const'之前需要主表达式sub2.cpp:11:6:警告:未使用的变量“外部”[-Wunused-variable]sub2.cpp:12:6:警告:未使用的变量‘inner’[-W

c++ - 当底层 OpenGL 状态被修改时,我是否应该声明一个方法 const

下面的类封装了缓冲区的OpenGL名称,并提供了一些改变缓冲区状态的方法:classBufferObject{public:explicitBufferObject(GLenumtype);virtual~BufferObject();//somemethodsomittedvoiddataStore(GLsizeiptrsize,constGLvoid*data,intusage);void*mapBufferRange(GLintptroffset,GLsizeiptrlength,intaccessFlag);voidunmapBuffer()const;private:GLui