缩进会向 const 方法添加额外的 const

Indent adds extra const to const methods

本文关键字:const 添加 方法 缩进      更新时间:2023-10-16

这是我的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文件缩进,就像我上面描述的那样。

有谁知道这可能是什么原因?

是的,我已经收到确认,这是当前缩进版本中的正式错误。