Clang-tidy change hungarian notation prefixes

105 Views Asked by At

The coding standards of a project I am working on require a _ as a separator between the Hungarian notation prefix and the variable name. For example:

uint32_t u32_MyVar;

By default clang-tidy formats it like so:

uint32_t u32MyVar;

How can I change the Hungarian notation prefix to include an underscore?

P.S. I tried using a variable prefix, but that is put before the Hungarian notation (i.e. _u32MyVar).

1

There are 1 best solutions below

0
Slav On

I found the solution - I needed to change the style of the notation to LowerCase (possible values are Off, On, LowerCase and CamelCase. To do this add the following option:

readability-identifier-naming.VariableHungarianPrefix: LowerCase

However, I also found out how to change the prefixes themselves by looking at the sources:

readability-identifier-naming.HungarianNotation.PrimitiveType.uint32_t: myPrefix32