[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: astyle configuration

From: Rik
Subject: Re: astyle configuration
Date: Mon, 13 Jan 2020 14:28:20 -0800

On 01/13/2020 01:37 PM, Gene Harvey wrote:
> On Mon, Jan 13, 2020 at 9:44 AM Rik <address@hidden> wrote:
>> I will work a bit more on this.  I use a separate file called astylerc
>> which throws many more configuration switches
>> --style=gnu
>> --indent=spaces=2
>> --max-code-length=80
>> --min-conditional-indent=0
>> --indent-namespaces
>> --indent-labels
>> --indent-cases
>> --pad-header
>> --keep-one-line-blocks
>> --keep-one-line-statements
>> --Rik
> Would it be a good idea to use clang-format instead? It has a more
> configuration
> options and it's more robust for handling edge cases (it uses clang's lexer).
> Unfortunately, I haven't been able to emulate Octave's style perfectly
> with it. The main issue
> for me is that it doesn't allow for separate syntax with regards to *
> and & placement other
> than by using an option which infers the style based on the current
> placement of those tokens.
> However, other than that I've come decently close to emulating the style.
I now have pretty good conformance with Octave's existing code base.  The
only reason, for me, to incur the switching costs would be if clang-format
handled the alignment of tertiary operators in a better manner.  An example is

octave_value retval = (! some_variable.isempty ()) ? true
                                                   : false;

astyle wants to pull the second line beginning with a colon back towards
column 1 rather than leaving it aligned under the '?' character.

My current astylerc is

--close-templates              # now that C++11 is required


reply via email to

[Prev in Thread] Current Thread [Next in Thread]