[lang-format:break function parameters

问题描述 投票:0回答:1

我想使用clang格式来生成C函数,例如:

void cfg_InitConfig
(
    cfg_Config_t* cfg,
    char*         name
)
{
    // TODO function
}

阅读该手册后,我认为clang格式无法做到。有可能吗?

c clang-format
1个回答
0
投票
clang格式的指针对齐尚未实现。请参考此方法

void WhitespaceManager :: alignConsecutiveDeclarations()

在以下链接中:Reference Link in Github

代码:

void WhitespaceManager::alignConsecutiveDeclarations() { if (!Style.AlignConsecutiveDeclarations) return; // FIXME: Currently we don't handle properly the PointerAlignment: Right // The * and & are not aligned and are left dangling. Something has to be done // about it, but it raises the question of alignment of code like: // const char* const* v1; // float const* v2; // SomeVeryLongType const& v3; AlignTokens(Style, [](Change const &C) { return C.IsStartOfDeclName; },Changes); }

希望这会有所帮助。
© www.soinside.com 2019 - 2024. All rights reserved.