缩进会向 const 方法添加额外的 const
Indent adds extra const to const methods
这是我的makefile
:
TRASH = *.o complex *~
complex: test.o complex.o
g++ -Wall -o $@ $^
test.o: test.cpp complex.hpp
g++ -Wall -c -o $@ $<
complex.o: complex.cpp complex.hpp
g++ -Wall -c -o $@ $<
PHONY: clean beauty
clean:
rm -f $(TRASH)
beauty:
indent -npsl -brf -cdb test.cpp complex.cpp complex.hpp
我的缩进选项格式化代码如下:
int function () {
/*
Comments
*/
}
问题:
如果我有一些具有原型的C++函数:Complex method_name(arguments) const;
每当我出于某种原因在.cpp
文件上使用make beauty
时,它都会添加一个const
,我的函数变成这样:
Complex method_name(arguments) const const {
/*
Comments
*/
}
注意:头文件缩进得很好,但.cpp
文件缩进,就像我上面描述的那样。
有谁知道这可能是什么原因?
是的,我已经收到确认,这是当前缩进版本中的正式错误。
相关文章:
- 为什么"std::add_pointer"会添加之前删除的"const"?
- 为什么必须将 const 添加到 constexpr 中才能进行字符串文字声明?
- 为什么在函数参数前面添加 const 会出错?
- 在下面函数的返回中添加 const 限定符的重要性是什么?
- 超载 运算符添加const char
- 为什么重写方法并将 const 添加到参数类型有效
- 为什么不能在模板函数中向局部变量添加低级 const 类型
- 通过const Rerefence传递向量并将元素添加到向量
- 在qabstractItemmodel :: data()const中,如何添加一些线程安全数据
- 为什么 C 与 C++ 相反,禁止在指针到指针的两个级别添加 const 限定
- 将字符数组添加到 const string&in C++
- 如何编写特征转换以将"const"添加到类型*
- c++将标志添加到const方法中
- 缩进会向 const 方法添加额外的 const
- 将字符串添加到 vector<const char *> 会给 strtok() 带来奇怪的行为
- 当通过const引用传递对象时,对象所发生的事情会被添加到类似std::map的容器中
- 为什么添加"const"可以解决"invalid operands to binary expression"
- 可以添加额外的const限定来破坏功能(假设编译顺利)
- 优雅地重用将const添加到类实例化中的代码
- Visual C++ 2010:如果我将"const"添加到一个比较中,为什么"signed/unsigned mismatch"消失了?