This
_Ty* pRCol, *pGCol, *pBCol;
get formatted as
_Ty* pRCol, * pGCol, * pBCol;
at least since version 3.4.0, but not in 2.2.5
Something similar happens with struct declarations:
typedef struct _A
{
ULONG foobar;
} A, *PA;
becomes
typedef struct _A
{
ULONG foobar;
} A, * PA;
I think this is affected by the option
--align-pointer=type
but no matter which version I use, some parts (not always the same) of the code get formatted weird. I will happily provide more information if needed. Tell me whatever would help. Thanks!
I would suggest that you reconsider this issue carefully. In my opinion, the style of formatting you want to preserve is extremely confusing. It puts you right between two common conventions:
--align-pointer=namemakes the most sense.--align-pointer=typeis a useful option.Last edit: w-peuker 2024-05-29
You certainly have a point here! I agree that the first example I brought up is a result of sloppy declaration/coding looking at it now! The 2nd one (the typedef with the struct) however is what I guess M$ introduced in their headers and which I therefore would consider being common practice, which has been copied a million times since then. Anyway: I agree that this is a problem, that needs to be solved elsewhere (meaning my code base for example;-) ). Thanks for the eye-opener!
Thanks for the reply which opened my eyes about the second case:
typedefcan indeed be “chained”, and I overlooked this because I'm mostly working in C++ wherestructalways introduces a type (notypedefneeded) and references and smart pointers make pointer types disappear in the code base.So, the issue can be refined to something like: the option
--align-pointer=typeshould only be applied to cases where pointer type and name are present around the*(the same would apply to--align-reference=typeand&).Does this make sense? Also to you @saalen?
That sounds phenomenal and makes perfect sense!
The version 3.5 should improve --align-pointer=type as duscussed.
I am looking into this. The behaviour was changed to be more consistent, but in these cases it looks wrong.