Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 3a775d24a2b34aa895d42d78bdccdda7 > files > 26

stardict-3.0.1-22.fc14.x86_64.rpm

Stardict's Coding Style:

By definition:
indentation - tab
style K&R, examples:
if () {
} else {
}
while () {
}
class foo {
}
switch () {
}
namespace {
}

exception function body:
void f()
{
}

naming like STD C++ libraries,
class the_class;
NOT class TheClass
void the_function()
NOT void TheFunction()

By good sense:
1)Use operation with spaces, 
NO a=b+c
YES a = b + c;

NOT for(i=0;i<10;++i)
YES for (i = 0; i < 10; ++i)

Reason: the second variant is more simple to read,
compare:
((long)p+(alg-1))&~(alg-1);

((long)p + (alg - 1)) & ~(alg - 1);

2)Functions should be short and sweet, and do just one thing.  They
should fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24,
as we all know), and do one thing and do that well.

Reason: see details in /usr/src/linux/Documentation/CodingStyle

3)length of one line should be <=80 characters
Reason: it's too hard read long lines of code.