草庐IT

implicitly-declared

全部标签

c++ - 在标准中,什么是 "derived-declarator-type"?

在C++(C++11)标准的不同地方,声明是根据derived-declarator-type-list来描述的。我正在研究右值引用,在这种情况下使用这个术语是至关重要的(第8.3.2节):InadeclarationTDwhereDhaseitheroftheforms    &attribute-specifier-seqoptD1    &&attribute-specifier-seqoptD1andthetypeoftheidentifierinthedeclarationTD1is“derived-declarator-type-listT,”thenthetypeofth

C++ 错误 : ‘string’ has not been declared

在我的头文件中,我得到了error:‘string’hasnotbeendeclared错误,但在文件顶部我有#include,那么我怎么会得到这个错误呢? 最佳答案 string位于std命名空间中,您必须使用std::string或通过using指令或using将其引入范围声明。 关于C++错误:‘string’hasnotbeendeclared,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/

c++ - static_cast 和 Implicit_cast 有什么区别?

什么是implicit_cast?我什么时候应该更喜欢implicit_cast而不是static_cast? 最佳答案 我正在复制我对answerthiscomment的评论在另一个地方。Youcandown-castwithstatic_cast.Notsowithimplicit_cast.static_castbasicallyallowsyoutodoanyimplicitconversion,andinadditionthereverseofanyimplicitconversion(uptosomelimits.you

c++ - 对依赖基类成员的非限定访问导致 "A declaration of [x] must be available"

代码://test3.cpp#includeusingnamespacestd;templatestructptr_stack_tp;templatestructptr_stack_tp:publicstack{~ptr_stack_tp(){while(!empty()){operatordelete(top());pop();}}};intmain(){}错误信息(gcc4.7.2):test3.cpp:Indestructor'ptr_stack_tp::~ptr_stack_tp()':test3.cpp:15:23:error:therearenoargumentsto'em

c++ - C 中 'allocated object having no declared type' 的 C++ 等价物是什么?

我正在用C++为我的VM编写内存管理器。好吧,更准确地说,VM指令将使用嵌入式内存管理器编译成C++。我在处理C方面更加自如,但现在我确实需要对异常处理的原生支持,这几乎是我使用C++的唯一原因。C和C++都有严格的别名规则,即不兼容类型的两个对象不得重叠,C中的union有一个小异常(exception)。但要定义malloc、calloc、alloca等内存分配函数的行为,C标准有以下段落。6.5-6Theeffectivetypeofanobjectforanaccesstoitsstoredvalueisthedeclaredtypeoftheobject,ifany.Allo

c++0x : resolving ambiguity between function-definition followed by empty-declaration and simple-declaration

我在思考c++0x规范中明显的歧义时遇到了问题,另请参阅:http://www.nongnu.org/hcb/假设我们有代码voidfoo(){};我个人将代码解释为function-definition后跟empty-declaration。但是,看看语法规范,我想说这可以很容易地解释为simple-declaration,它是block-declaration的一部分,因此被提及declaration列表中的较早...这是我对如何将其解析为简单声明的解释:voidfoo(){};"->简单声明void->decl-specifier-seq->decl-specifier->typ

c++ - 警告 : overflow in implicit constant conversion

在下面的程序中,第5行确实按预期给出了溢出警告,但令人惊讶的是,第4行在GCC中没有给出任何警告:http://www.ideone.com/U0BXnintmain(){inti=256;charc1=i;//line4charc2=256;//line5return0;}我在想这两行都应该给出overflow警告。还是我缺少什么?我做这个实验的主题是:typedeftypechecking?在那里我说了以下内容(我从答案中删除了,因为当我运行它时,它并没有像我预期的那样显示)://However,you'llgetwarningforthiscase:typedefintT1;ty

c++ - 使 : implicit rule to link c++ project

我正在学习制作教程。我正在尝试构建的非常简单的测试项目只有3个文件:./src/main.cpp./src/implementation.cpp和./include/header.hpp这是制作文件。VPATH=srcincludeCPPFLAGS=-Iincludemain:main.oimplementation.omain.o:header.hppimplementation.o:header.hpp在不带任何参数的情况下调用ma​​ke仅构建目标文件,但不链接可执行文件。prog应该有一个隐含的规则,或者我错过了什么?我真的需要有人为我指明正确的方向。谢谢。我使第一个目标名称与

c++ - 带有 Cygwin 1.7 的 GoogleTest 1.6 编译错误 : 'fileno' was not declared in this scope

带有Cygwin1.7的GoogleTest1.6:“fileno”未在此范围内声明在EclipseCDT中对Factorial()函数进行简单测试时出现错误消息:Invoking:CygwinC++Compilerg++-std=c++0x-DGTEST_OS_CYGWIN=1-I"E:\source\gtest-1.6.0\include"-O0-g3-Wall-c-fmessage-length=0-MMD-MP-MF"src/challenge.d"-MT"src/challenge.d"-o"src/challenge.o""../src/challenge.cpp"Infi

C++ 错误 : Sleep was not declared in this scope

我在Ubuntu中使用带有codeBlocks的C++,在GCC4.7中boost1.46[yield_k.hpp]我得到这个编译时错误:error:Sleepwasnotdeclaredinthisscope代码:#includeusingnamespacestd;intmain(){cout如何解决此错误?我希望程序挂起1秒。 最佳答案 Sleep是一个Windows函数。对于Unix,请考虑使用nanosleep(POSIX)或usleep(BSD;已弃用)。一个nanosleep示例:voidmy_sleep(unsigne