[systemd-devel] [PATCH] use static_assert instead of assert_cc

Lennart Poettering lennart at poettering.net
Thu Jan 3 14:00:14 PST 2013


On Thu, 03.01.13 22:47, Thomas H.P. Andersen (phomes at gmail.com) wrote:

> > assert_cc() for simple expressions where the expression is readable
> > enough as is.
> >
> > assert_static() for complex expressions where it is worth specifying a
> > human readable string.
> >
> > I hope this makes sense?
> 
> yeah, makes sense. It also does not break the build for older
> compilers :) Do you see warnings about mixed declarations and code? I
> had to move some of the asserts to avoid that with my patch.

Yes, I did see those. And my dirty workaround was to simply enclose the
assert_static() in a do { } while(false) block... That way it's always
at the beginning of a {} block but still behaves like an individual
expression.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list