On 06/03/2016 02:52 PM, Thiago Macieira wrote:
I've seen a lot of code do:

#ifdef FOO
        if (foo) {
                // something
        } else
#endif
        if (bar) {
                // something else
        } else {
                // default
        }

This kind of thing is an abomination that should never ever be allowed, regardless of other coding style considerations. You can hardly even tell whether the code is syntactically correct in both cases, let alone semantics. Factor out ifdefs into dedicated functions whenever possible. You'll be glad you did, and even more so the people who have to read your code later.


Christian
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to