草庐IT

intel-syntax

全部标签

c++ - 将 'using' 指令与部分重载 : gcc feature or intel bug? 相结合

我希望将一组用C++编写的库与英特尔编译器一起使用。我附上了演示问题的示例代码。库中有很多地方使用了“using”指令与部分重载的组合(例如,我想使用基类中的foo(void)方法,但在派生类中重新实现第二个版本fofoo).gcc没有问题,但intel有。#includetemplatestructInterface{staticconstFf=10;};templatestructBase:publicInterface{voidfoo(void){std::coutvoidfoo(Interface&ii){std::coutstructDerived:publicBase{//

c++ - 循环地址对齐如何影响 Intel x86_64 上的速度?

我看到编译为完全相同的机器指令但位于不同对齐地址的相同C++代码的性能下降了15%。当我的微型主循环从0x415220开始时,它比从0x415250开始时更快。我在IntelCore2Duo上运行它。我在x86_64Ubuntu上使用gcc4.4.5。谁能解释减速的原因以及我如何强制gcc以最佳方式对齐循环?下面是两种情况的反汇编,带有探查器注释:41522057612.56%|XXXXXXXXXXXXXX48c1eb08shr$0x8,%rbx4152241102.40%|XX0fb6c3movzbl%bl,%eax4152270.00%|410fb60400movzbl(%r8,%

c++ - Visual Studio 2015 "non-standard syntax; use ' &' to create a pointer to member"

我正在尝试用C++实现自己的链表,但终究无法弄清楚为什么会出现此错误。我知道有一个STL实现,但出于某种原因,我正在尝试自己的实现。这是代码:#includetemplateclassListElement{public:ListElement(constT&value):next(NULL),data(value){}~ListElement(){}ListElement*getNext(){returnnext;}constT&value()const{returnvalue;}voidsetNext(ListElement*elem){next=elem;}voidsetValu

c++ - g++ vs intel/clang 参数传递顺序?

考虑以下代码(LWS):#include#includeinlinevoidtest(conststd::chrono::high_resolution_clock::time_point&first,conststd::chrono::high_resolution_clock::time_point&second){std::cout您必须多次运行它,因为有时并没有明显的区别。但是当first和second的计算时间存在明显差异时,g++下的结果如下:13633762393631751363376239363174以及intel和clang下的以下内容:13633762679714

c++ - 当数据隐藏在对象中时如何使用 intel prefetch pragma?

Intel提供了预取编译指示,很有帮助;例如#pragmaprefetchafor(i=0;i将预取a一定数量的循环周期,由编译器决定。但是如果a不是一个数组而是一个覆盖了[]的类呢?如果operator[]做一个简单的数组访问,prefetch还能这样用吗?(大概这个问题也适用于std::vectors)。 最佳答案 找出答案的一种方法是尝试并查看程序集。如果还有其他问题,只需使用和不使用pragma对其进行基准测试。但是,我不确定prefetchpragma是否是您想要的:Theprefetchpragmaissupported

c++ - Intel Inspector 报告我的自旋锁实现中存在数据竞争

我使用Windows中的Interlocked函数制作了一个非常简单的自旋锁,并在双核CPU上对其进行了测试(两个线程递增一个变量);该程序似乎运行正常(它每次都给出相同的结果,当没有使用同步时情况并非如此),但是IntelParallelInspector说在value+=j(见下面的代码)。当使用关键部分而不是我的SpinLock时,警告消失。我的SpinLock实现是否正确?这真的很奇怪,因为所有使用的操作都是原子的并且有适当的内存屏障,它不应该导致竞争条件。classSpinLock{int*lockValue;SpinLock(int*value):lockValue(val

android - 房间 (AAC) : [SQLITE_ERROR] SQL error or missing database (near "group": syntax error)

FollowingDao没有在我的Android应用中构建:@DaointerfaceGroupDao{@Insertfuninsert(group:Group)@Query("SELECT*FROMgroup")funloadAll():LiveData>}当我在AndroidStudio3中构建项目时,我在gradle构建步骤中收到以下错误::app:kaptDebugKotline:C:\workspaces\SystemicConsensusKotlin\app\build\tmp\kapt3\stubs\debug\de\maxdobler\systemicconsensus

android - 房间 (AAC) : [SQLITE_ERROR] SQL error or missing database (near "group": syntax error)

FollowingDao没有在我的Android应用中构建:@DaointerfaceGroupDao{@Insertfuninsert(group:Group)@Query("SELECT*FROMgroup")funloadAll():LiveData>}当我在AndroidStudio3中构建项目时,我在gradle构建步骤中收到以下错误::app:kaptDebugKotline:C:\workspaces\SystemicConsensusKotlin\app\build\tmp\kapt3\stubs\debug\de\maxdobler\systemicconsensus

c++ - 错误 C2146 : syntax error : missing ';' before identifier

我无法摆脱这些错误...我检查的每个地方都有分号...代码很简单:该错误将我带到article.h中的定义“字符串名称”...主要.cpp#include#include#include#includeusingnamespacestd;#include"article.h"intmain(){stringsi;chararticle[128];vectorarticles;ifstreamfile;file.open("input.txt",ifstream::in);while(!file.eof()){file.getline(article,128);articles.push

c++ - 错误 C2143 : syntax error : missing ';' before 'using'

关闭。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭8年前。Improvethisquestion这是我的标题:#ifndefHEADER_H#defineHEADER_HclassMath{private:staticenumnames{amin=27,ali=46};public:staticvoiddisplayMessage();}#endif//HEADER_H这是标题定义:#incl