bug-groff
[Top][All Lists]
Advanced

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

[bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause


From: Ingo Schwarze
Subject: [bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause
Date: Fri, 8 May 2020 08:30:51 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; OpenBSD amd64; rv:75.0) Gecko/20100101 Firefox/75.0

Update of bug #58314 (project groff):

                Category:                    Core => Preprocessor preconv   
                Severity:              3 - Normal => 1 - Wish               
                  Status:               Need Info => Invalid                
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #2:

This ticket is now moot because gbranden@ decided to revert the code change
causing the compiler warning, for reasons unrelated to this ticket.

Anyway, i consider opening tickets for personal style issues that  clearly do
not indicate bugs rather pointless behaviour.

> ../src/preproc/preconv/preconv.cpp:959:6: warning: 
> suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
>   959 |   if (fseek(fp, -limit, SEEK_END) != 0)

Most coding styles agree that

        if (outer) {
                if (inner)
                        do_this();
                else
                        do_that();
        }

is easier to read than

        if (outer)  
                if (inner)
                        do_this();
                else
                        do_that();

which you used.


gbranden@ wrote:

> https://www.gnu.org/prep/standards/html_node/Formatting.html

I don't see that page talking about -Wdangling-else in particular.

> That's not the brace style in use in the codebase.

It is, for example look at the functions unicode_entity() and
conversion_iconv() in the file preconv.cpp which contain if-else statements
right inside if and else clauses and which do use braces on the outer if and
else clauses even though these outer braces are not required by the C
standard.

> My own brace style preference is 1TBS.
> I welcome comments from other groff developers.

Unsurprisingly, my personal preference is K&R style in the BSD KNF variant in
the OpenBSD KNF variant,

  https://man.openbsd.org/style.9

but i don't think that matters here at all.  :-)

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58314>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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