[Scummvm-devel] Revisiting coding convention for empty loop body
Paul Gilbert
paulfgilbert at gmail.com
Sat Apr 21 12:54:41 CEST 2018
Hmmm.. if we'd need to do some form of change to existing code to , I'd be
more in favor of mandating the use of {} rather than the semicolon, as
opposed to requiring an entire comment just to say that it's intentional
that the loop doesn't have a body. It would convey the same information, in
a more compact form. And it would have the advantage of bypassing the
question of whether semicolons should have spaces in front of them.
Paul.
On Fri, Apr 20, 2018 at 4:30 PM, Adrian Frühwirth <scummvm-devel at bonki.net>
wrote:
> Hi everybody,
>
> Our CFCs currently state that trailing semicolons belonging to empty loops
> should be preceded by a space when on the
> same line _and_ that the loop should be marked intentional with an
> appropriate comment. This was added to our CFCs after
> a short discussion on -devel in 2010 [1].
>
> A quick grep reveals that there is not a single occurrence with such a
> comment (at least not where the semicolon is on
> the same line) and most also skip the preceding space.
>
> The reason why this was proposed was that gcc warns about empty loop
> bodies when using -Wextra or -Wempty-body [2].
> However, looking at our configure script, this warning seems to be
> disabled currently [3].
>
> If we intend to keep the warning disabled I would like to drop the
> requirement for either the extra space or the
> comment, having both seems a bit redundant. I'm in strong favor of keeping
> the comment (or rather, add it where
> necessary) and drop the space before the semicolon.
>
> Is anybody against this change?
>
> -Adrian
>
> [1] http://lists.scummvm.org/pipermail/scummvm-devel/2010-
> April/007554.html
> [2] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
> [3] https://github.com/scummvm/scummvm/blob/master/configure#L2033
>
> _______________________________________________
> Scummvm-devel mailing list
> Scummvm-devel at lists.scummvm.org
> http://lists.scummvm.org/listinfo/scummvm-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20180421/df2b9f50/attachment.html>
More information about the Scummvm-devel
mailing list