【问题标题】:How to keep the parameters of a compound initializer function argument together with clang format如何将复合初始值设定项函数参数的参数与 clang 格式保持在一起
【发布时间】:2021-07-06 10:51:28
【问题描述】:

在函数调用中使用复合初始值设定项的 sn-p

foo_make_person(ctx, &(foo_person_desc){
       .name = "Bob",
       .age = 50,
});

我怎样才能让 clang-format 像这样格式化这段代码?

我尝试过的一切看起来总是错误的。比如

foo_make_person(
       ctx,
       &(foo_person_desc){
           .name = "Bob",
           .age = 50,
       });

或者这个

foo_make_person(ctx,
           &(foo_person_desc){
               .name = "Bob",
               .age = 50,
           });

或者这个

foo_make_person(ctx, &(foo_person_desc){
                       .name = "Bob",
                       .age = 50,
                   });

【问题讨论】:

    标签: c clang-format


    【解决方案1】:

    经过进一步研究,我得出的结论是clang-format,就当前版本而言,无法进行这种格式化。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-24
      • 2015-07-31
      • 1970-01-01
      • 2013-10-10
      • 2021-05-15
      • 2020-05-15
      • 2020-02-02
      • 2019-02-17
      相关资源
      最近更新 更多