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

Lennart Poettering lennart at poettering.net
Thu Jan 3 13:34:03 PST 2013


On Sat, 29.12.12 02:10, Thomas H.P. Andersen (phomes at gmail.com) wrote:

> Another item from the todo

Heya!

Hmm, so I commited a patch for using assert_static() a few days before
you did your patches but unfortunately never commited it.

It works a bit differently from your patch, i.e. keeps assert_cc() as
special version of assert_static() around which only takes one rather
than two parameters and generates the message from the passed
expression.

I am tempted to just leave this code now as I commited it, since having
to pass an explicit string to assert_static() is sometimes a bit
redundant i'd say, and doesn't really make things more readable unless
the expression that is tested is really complicated.

Hence, I'd say that we should use assert_cc() and assert_static() from
now on like this:

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?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list