Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.groff.bug > #1845
| From | Ingo Schwarze <INVALID.NOREPLY@gnu.org> |
|---|---|
| Newsgroups | gnu.groff.bug |
| Subject | [bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause |
| Date | 2020-05-08 08:30 -0400 |
| Message-ID | <mailman.2416.1588941052.3066.bug-groff@gnu.org> (permalink) |
| References | <20200506-203934.sv93188.74567@savannah.gnu.org> <20200507-222556.sv108747.87164@savannah.gnu.org> <20200508-123050.sv97361.91915@savannah.gnu.org> |
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/
Back to gnu.groff.bug | Previous | Next | Find similar
[bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause Ingo Schwarze <INVALID.NOREPLY@gnu.org> - 2020-05-08 08:30 -0400
csiph-web