Coding style: block braces in switch cases
Kevin Krammer
krammer at kde.org
Mon Jan 13 16:05:04 GMT 2014
Hi all,
at KDE PIM we are cleaning up our code base from over a decade of different
coding styles. Well, "we" means Guy Maurel, he does all the actual work :)
We follow the "kdelibs" rules which in turn are close to what Qt uses IIRC.
Now we've hit a snag. There is no common rule regarding block braces in cases
of switch statements.
All example of switch statements show that the switch block braces start at
the line of the switch condition, just like with if conditions or loops.
They also show that case is aligned with switch, i.e. no intentation.
However, there seems to be no rule how to place block braces for case
statements.
I've looked around and found quite a variation:
e.g. qdatetime.cpp:
switch (...) {
case Foo: {
}
}
e.g. qrasterizer.cpp:
switch (...) {
case Foo:
{
}
}
e.g. qcommandlineparser.cpp:
switch (...) {
case Foo:
{
}
}
e.g. qlocale.cpp:
switch (...) {
case Foo: {
}
}
Any thoughts anyone?
Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20140113/9645172c/attachment.sig>
More information about the kde-core-devel
mailing list