Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
EclipseCDTisconst检查_Eclipse_Eclipse Cdt - Fatal编程技术网

EclipseCDTisconst检查

EclipseCDTisconst检查,eclipse,eclipse-cdt,Eclipse,Eclipse Cdt,我有一个简单的指针.c文件: #include<stdio.h> // Pointer To Constant const int* ptrToConst ; //Constant Pointer int* const ConstPtr ; 输出为: Variable Name: ptrToConst Is Constant: true Variable Name: ConstPtr Is Constant: false 根据输出,指向常量的第一个变量被解析为常量,而另一

我有一个简单的指针.c文件:

#include<stdio.h>

// Pointer To Constant
const int* ptrToConst ;


//Constant Pointer
int* const ConstPtr ;
输出为:

Variable Name: ptrToConst
Is Constant: true

Variable Name: ConstPtr
Is Constant: false
根据输出,指向常量的第一个变量被解析为常量,而另一个变量则不是常量指针。我不明白这种行为,为什么会这样?CDT对指针变量的理解是否不同?根据我的理解,输出应该正好相反

在调试时检查第二种情况下的变量d详细信息:

自(见)

  • const int*ptrtocont
    声明指向常量整数的指针(可修改)
  • int*const ConstPtr
    声明一个指向整数(可修改)的contant指针
在第二种情况下,
sd.getDeclSpecifier().isConst()
返回
false


因此,在第二种情况下,
常量
修饰符
可以在
的抽象语法树中找到(正如您自己发现的那样)。

在循环的
行中设置一个断点,并找出在抽象语法树中的位置(
ast
)关于第二个案例的
const
修饰符的信息是hold。我试过了,但没有得到这样的信息。我们到底可以在哪里调查呢?已经添加了它的截图,请检查。非常感谢。您查看过声明器>[0]>pointerOps吗?刚刚检查过,它正确地位于pointerOps之下!!谢谢!你能解释一下原因吗?
Variable Name: ptrToConst
Is Constant: true

Variable Name: ConstPtr
Is Constant: false