From koffice-devel Tue Jan 19 21:32:51 2010 From: Dmitry Kazakov Date: Tue, 19 Jan 2010 21:32:51 +0000 To: koffice-devel Subject: Re: Concerning automated astyle application to the code Message-Id: X-MARC-Message: https://marc.info/?l=koffice-devel&m=126393683104947 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0112039255==" --===============0112039255== Content-Type: multipart/alternative; boundary=00032555f9ca47186a047d8b3642 --00032555f9ca47186a047d8b3642 Content-Type: text/plain; charset=UTF-8 On Tue, Jan 19, 2010 at 5:47 PM, Jaroslaw S wrote: > 2010/1/19 Inge Wallin : > > On Monday 18 January 2010 09:14:32 Thomas Zander wrote: > >> On Sunday 17. January 2010 20.53.44 Dmitry Kazakov wrote: > >> > I know it is good to keep the code in a good consistent style. But > here > >> > is a piece of code, changed by automated astyle commit: > >> > >> [] > >> > >> > if (child && > >> > child->channelFlags().isEmpty() && > >> > child->projection() && > >> > child->visible() && > >> > child->opacity() == OPACITY_OPAQUE && > >> > *child->projection()->colorSpace() == *colorSpace()) { > >> > >> For this reason I now write the double ampersand at the start of a line, > >> which makes it still legal coding style, but easier to read. > >> So; > >> if (foo > >> && bar) > >> > > > > I know that Thomas and I don't always have the same opinions on style but > on > > this one I'm with him 100%. > > > > Reading something like > > > > if ( a very looooooooooooooooooooong and coooooooomplicated expression > && > > something else that is very complicated || > > foo) > > btw, I am using one extra tiny guideline here: for multiline > conditions I move{ to the new line and align operators: > > if ( averylooooooooooooooooooooong and coooooooomplicated expression > && something else that is very complicated > && foo) > { > //.... > } > > this way for me it is harder to confuse the second and third line of > the condition with the body of the if. Doesn't astyle "fixes" this? ;) -- Dmitry Kazakov --00032555f9ca47186a047d8b3642 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Tue, Jan 19, 2010 at 5:47 PM, Jarosla= w S <kexipl@gmail.= com> wrote:
2010/1/19 Inge Wallin <inge@lysat= or.liu.se>:
> On Monday 18 January 2010 09:14:32 Thomas Zander wro= te:
>> On Sunday 17. January 2010 20.53.44 Dmitry Kazakov wrote:
>> > I know it is good to keep the code in a good consistent style= . But here
>> > is a piece of code, changed by automated astyle commit:
>>
>> []
>>
>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (child &&
>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 child= ->channelFlags().isEmpty() &&
>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 child= ->projection() &&
>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 child= ->visible() &&
>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 child= ->opacity() =3D=3D OPACITY_OPAQUE &&
>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *chil= d->projection()->colorSpace() =3D=3D *colorSpace()) {
>>
>> For this reason I now write the double ampersand at the start of a= line,
>> =C2=A0which makes it still legal coding style, but easier to read.=
>> So;
>> =C2=A0 if (foo
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 && bar)
>>
>
> I know that Thomas and I don't always have the same opinions on st= yle but on
> this one I'm with him 100%.
>
> Reading something like
>
> =C2=A0if ( a very looooooooooooooooooooong and coooooooomplicated expr= ession =C2=A0&&
> =C2=A0 =C2=A0 =C2=A0 something else that is very complicated ||
> =C2=A0 =C2=A0 =C2=A0 foo)

btw, =C2=A0I am using one extra tiny guideline here: for multiline conditions I move{ to the new line and align operators:

if ( =C2=A0 =C2=A0averylooooooooooooooooooooong and coooooooomplicated expr= ession
=C2=A0 =C2=A0 && something else that is very com= plicated
=C2=A0 =C2=A0 && foo)
{
=C2=A0//....
}

this way for me it is harder to confuse the second and third line of
the condition with the body of the if.

Does= n't astyle "fixes" this? ;)=C2=A0

--
Dmitr= y Kazakov
--00032555f9ca47186a047d8b3642-- --===============0112039255== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel --===============0112039255==--