[systemd-devel] [systemd-commits] 4 commits - catalog/systemd-fr.catalog catalog/systemd-ru.catalog configure.ac Makefile.am po/.gitignore po/LINGUAS po/ru.po

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Dec 2 10:25:48 PST 2013


On Mon, Dec 02, 2013 at 04:58:40PM +0100, Lennart Poettering wrote:
> On Sun, 01.12.13 01:26, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> 
> > 
> > On Fri, Nov 29, 2013 at 02:45:21PM -0500, Colin Walters wrote:
> > > On Fri, 2013-11-29 at 02:39 +0100, Lennart Poettering wrote:
> > > > On Thu, 28.11.13 00:54, Zbigniew Jędrzejewski-Szmek (zbyszek at kemper.freedesktop.org) wrote:
> > > 
> > > > Instead we should add some code to macro.h which turns off the the
> > > > warning with the #pragma stuff only if it detects it is being run on an
> > > > old gcc.
> > > 
> > > There's also this approach:
> > > 
> > > 
> > 
> > > From 7affb075dd1889fbb6b8d8865dec4b5e1d36448f Mon Sep 17 00:00:00 2001
> > > From: Colin Walters <walters at verbum.org>
> > > Date: Fri, 29 Nov 2013 14:43:45 -0500
> > > Subject: [PATCH] macro: Split assert_cc, add assert_cc_toplevel
> > > 
> > > To suppress warnings about -Wdeclaration-after-statement, we need to
> > > wrap static asserts inside functions with a standard do {} while(0)
> > > block.  But the toplevel asserts can't have that, so add
> > > assert_cc_toplevel for those.
> > Actually I don't think we need to totally forbid declarations after statements.
> > This is not something likely to be introduced by mistake, so I think
> > we'll be fine even if only humans check for that.
> 
> I must say I really dislike mixing declarations and code. And I also
> know that by accident I did this in many cases myself and was thankful
> for the compiler to tell me about this.
I never understood this. There are many situations where initializing
variables right when they are declared leads to more readable
code. And if everything has to be declared at the top, this often
isn't possible. Especially with long functions which have many
logically separate segments this leads to an unreadable lump of
declarations at the top. We already declare variables at the start of
internal scopes, and declaring them in the middle of code is just
another small step.

Zbyszek


More information about the systemd-devel mailing list