Double newlines following function definitions

我是研究僧i 提交于 2021-01-29 03:06:52

问题


Is it possible to use clang-format to have double newlines between function definitions:

void func1() 
{
    return;
}


void func2() 
{
    return;
}

回答1:


If you are asking whether the IDE can insert these lines automatically, I don't believe so. You can have any number of lines but only by manually entering them.




回答2:


clang-format does not have an option controlling the number of newlines after the function definition. However, it does have an option, MaxEmptyLinesToKeep, which will keep it from undoing your two empty lines. So, you will have to cook up some way of doing this through your editor and clang-format with MaxEmptyLinesToKeep set to 2, or higher, will respect your decision.



来源:https://stackoverflow.com/questions/28826390/double-newlines-following-function-definitions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!