I have brace-enclosed lists to initialize an array. I'd like to have my array initializers new-line for each entry of the array, which looks like:
const char* const array_of_strings[] = {
"Hey",
"Hi",
"Hello",
"Soup",
"Atom"
};
Though, clang-format formats this array to:
const char *const array_of_strings[] = {"Hey", "Hi", "Hello", "Soup", "Atom"};
usually new lining once the list gets past ColumnLimit. Is my wanted formatting possible using clang-format?
It is mostly possible. You need two things:
BinPackArguments
style option tofalse
. I guess clang-format is treating the brace-enclosed initializer list as arguments. (The documentation doesn't really specify this, but it seems reasonable.)With both of the above, and otherwise default clang-format settings, your output would look like: