草庐IT

declaration-specifiers

全部标签

c++ - 用于解析 C 和 C++ 声明的螺旋规则和 'declaration follows usage'

此问题跟随thisotherquestionaboutCdeclarations.阅读这个问题的答案,我读到了spiralrule而且我也理解了“声明遵循用法”的含义。到目前为止还可以。但后来我读到thisdeclaration:char*(*(*a[N])())();我想知道如何使用“声明遵循用法”“规则”来解析它。尤其是数组部分。我读的是:(*(*a[N])())是一个函数()返回一个char*,然后,解引用以下(*a[N])()//1这个'函数返回一个char*',所以1是一个'指向返回char*的函数的指针'那么我会说'当(*a[N])被调用时,它是[previousdecla

c++ - 在 using-declaration 中,依赖名称可以在模板替换后呈现给构造函数吗?

在这个例子中:templatestructS:T{usingT::X;};T::X是指成员X的从属名称在T.如果S用T=X实例化:structX{X(int){}};...Ss(42);using-declaration会变成inheriting-constructor吗?Clang拒绝代码DEMO,而g++接受它。请注意,如果我们写:usingT::X::X;两个编译器都接受代码并将其视为继承构造函数。是usingT::X允许按标准成为继承构造函数吗? 最佳答案 感谢T.C.指出这一点:Coreissue2070正处于起草阶段(已

c++ - using-declaration 不能在函数范围内重复。这是为什么?

在[namespace.udecl]/10中有以下示例:namespaceA{inti;}namespaceA1{usingA::i;usingA::i;//OK:doubledeclaration}voidf(){usingA::i;usingA::i;//error:doubledeclaration}这段代码在clang中编译。 最佳答案 第一个是命名空间内的声明,多个using语句可能经常使用#includes发生。第二个是在函数的定义中,除非你犯了错误,否则你永远不会这样做。例如,您也不能将同一个符号定义两次,但可以声明多

c++ - 为什么静态成员函数_declared_是静态的,而在C++中却是_defined_?

这是一个最小的工作示例:啊哈:classA{staticinta_member_function();};A.cpp#include"A.h"intA::a_member_function(){return5;}intmain(){return1;}这段代码编译并运行,但是,在我看来:staticintA::a_member_function(){return5;}可以很容易地用于定义类A的静态成员函数。事实上,有这个要求似乎实际上是相当有用的,因为它会提醒.cpp文件的读者a_member_function是静态的.但是,这显然行不通:error:cannotdeclaremembe

c++ - 带有 using-declarations 链接的程序在 MSVS 和 clang 上编译,但在 GCC 上不编译

根据c++标准,以下程序是良构的还是良构的?namespaceX{inti;}namespaceY{usingX::i;}intmain(){usingX::i;usingY::i;}我使用不同的编译器得到不同的结果:MSVS:编译(http://webcompiler.cloudapp.net/)Clang:编译(http://melpon.org/wandbox/permlink/KloDufJ5h1DalK4v)GCC:编译错误(http://melpon.org/wandbox/permlink/IKuuQGE1THofuUTr)我不想修复这个程序以使其在GCC上编译。我只想知

c++ - protected 成员是派生类中的 "not declared in this scope"

这个问题在这里已经有了答案:accessingprotectedmembersofsuperclassinC++withtemplates[duplicate](2个回答)关闭8年前。#include#includetemplateclassBase{protected:std::vectordata_;};templateclassDerived:publicBase{public:voidclear(){data_.clear();}};intmain(intargc,char*argv[]){Derivedderived;derived.clear();return0;}我无法编

node.js - npm - 错误 : The specified procedure could not be found

错误:module.js:347'formodule'+JSON.stringify(this.id));^Error:Thespecifiedprocedurecouldnotbefound.c:\Users\Artur\workspace\xxx\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64\binding.nodeatError(native)atModule.load(module.js:355:32)atFunction.Module._load(module.js:310:12)atModule

node.js - Node 错误,nodeenv : couldn't find any version specified for use

成功安装Node后,我得到以下信息;$npmnodenv:couldn'tfindanyversionspecifiedforuse$nodenodenv:couldn'tfindanyversionspecifiedforuse有人知道这是从哪里来的吗?我通过mac上的标准教程安装了node/npm,但我不断收到此错误。有什么我应该做但没有做的吗?编辑:上一个问题提示这个错误是由于boxen。事实并非如此,所以我稍微改变了问题以避免混淆。 最佳答案 原来我找不到允许您设置版本的命令;你可以通过nodenv命令查看所有不同的版本;$

node.js - 错误 : The specified module could not be found

我正在尝试使用edge.js执行一些.NET代码以在Electron应用程序的窗口上打印。我试过electron-edge我还尝试在instructionsintheElectrondocs之后手动构建针对Electron的edge.js模块,但是当我尝试在打包的应用程序中使用边缘时,我不断收到以下错误:Error:Thespecifiedmodulecouldnotbefound.\\?\C:\path\to\app\app-1.0.0\resources\app.asar.unpacked\node_modules\edge\lib\native\win32\x64\6.5.0\e

node.js - 错误 : No default engine was specified and no extension was provided

我正在使用node.js和引擎设置http服务器。但是,我一直遇到一些我对如何解决的信息知之甚少的问题,我希望能得到一些帮助来解决这个问题。Error:Nodefaultenginewasspecifiedandnoextensionwasprovided.atnewView(...\node_modules\express\lib\view.js:41:42)atFunction.app.render(...\node_modules\express\lib\application.js:484:12)atServerResponse.res.render(...\node_modu