Uncrustify currently does not keep track of braces that span multiple preprocessor blocks and therefore will abort and complain about missing braces in code like the example below:
#if(1) if(true) { #endif int i = 1; #if(1) } #endif
If you want to use Uncrustify on your code, avoid this kind of brace placement until this problem is fixed.
C++ is a notoriously hard to parse language as its grammar is ambiguous, context-dependent and potentially requires infinite lookahead to resolve some ambiguities.
Currently Uncrustify's parser is not well equipped to handle such edge cases well. This construct, for example, is problematic:
The above example could either be:
A declaration of a function b
with A
as return type, c*
as a parameter type, and d
as the parameter name
or
A declaration of a variable b
of type A
, with a constructor call with the parameter of variable c
multiplied by variable d
To remove the ambiguity in the above example, parenthesis can be added around c
so that the construct will be parsed as a variable declaration.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4