[petsc-dev] Style Guide: How to format single-line if/for/while-blocks?

Matthew Knepley knepley at gmail.com
Mon Jan 21 19:53:18 CST 2013


On Mon, Jan 21, 2013 at 7:18 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

>
> On Mon, Jan 21, 2013 at 7:05 PM, Karl Rupp <rupp at mcs.anl.gov> wrote:
>
>>      Things like
>>>
>>>      if (y < 12) {ierr = Something(); CHKERRQ(ierr);}
>>>
>>> don't match the standard but …. am I being too picky? I believe the
>>> PETSc make uncrustify rule would move that to separate lines.
>>>
>>
>> I expect that it's a lot easier to define a rule where '{' opens a new
>> block on the next line rather than having a 'sometimes it's a single
>> line'-type of exception.
>
>
> Yes, though
>
> if (y < 12) {
>   ierr = Something();CHKERRQ(ierr);
> }
>
> takes three times as many lines. I don't care much either way, but it's
> nice to not waste vertical space.
>

I agree here.

  Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130121/71d7e06d/attachment.html>


More information about the petsc-dev mailing list