Possibly related to #572 and/or #573.
Occurs using astyle version 3.5.2 on both Ubuntu 24.04 and Windows 10.
When using options --pad-oper and --align-pointer=type (and --align-reference=type, although as I understand it, that's unnecessary if using --align-pointer=type), pointer dereferences and addresses are formatted as if they were multiplication or logical AND operators. For instance:
int* ptr;
*ptr = 10;
int x;
int* ptr2 = &x;
foo(&x, *ptr);
becomes
int* ptr;
* ptr = 10;
int x;
int* ptr2 = & x;
foo( & x, * ptr);
Full .astylerc attached.
Note: just tested without
--pad-operand the behavior described does not occur. Using the same settings except--pad-oper, the first codeblock remains unchanged.Let me know if you need any more info.
Should be fixed in 3.6.0
Apologies for the delayed response. This issue does not yet seem to be fixed, or at least it does not behave as I expected. The behavior is definitely different now, as follows - with the same .astylerc as before, now running v3.6.0:
This:
is formatted to this:
which is strange.
More interestingly, this:
is formatted to this:
when I would expect this:
I will also note that spaces between the type keyword and the asterisk are correctly removed. Also, again, removing the
--pad-operargument leaves both examples unchanged.Thanks for your work.
Last edit: RyzenFromFire 2024-08-20
The padding within parens was fixed in 3.6.1. Others need some special handling.
The problem with
* ptr = 10;is still present in 3.6.9Last edit: Eugene Sandulenko 2025-05-12