遵循函数定义的双换行符 [英] Double newlines following function definitions

查看:84
本文介绍了遵循函数定义的双换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用clang格式在函数定义之间使用双换行符:

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

void func1() 
{
    return;
}


void func2() 
{
    return;
}

推荐答案

clang-format 没有在函数定义后控制换行数的选项.但是,它确实有一个选项 MaxEmptyLinesToKeep ,这将防止它撤消两条空行.因此,您将必须通过编辑器和 clang-format MaxEmptyLinesToKeep 设置为 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.

这篇关于遵循函数定义的双换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆