How To Place Typedef Name On New Line After Closing Brace With Clang-Format? (original) (raw)

September 24, 2023, 11:14pm 1

Hello,

I am currently using clang-format to style my C code and I have run into a bit of a challenge. In my project, I am declaring typedef structs similar to the one shown below:

typedef struct
{
    string name;
    string number;
}
person; 

I would like the typedef name (person in this example) to start on a new line after the closing brace of the struct definition.

I looked through the clang-format documentation and options, but couldn’t find a setting that controls this aspect of formatting. I want to keep person on a new line to make my code more readable and better fit my existing code style.

Is there a way I can achieve this with clang-format? Or is this a feature that could be considered for a future version of clang-format?

I appreciate any help or advice you may have to offer!