What coding style should be used?
Hi,
as you might have seen from my other mails I'm working on mutliarch
for dpkg. So I've patched quite a few of the source files and looked
at more. Unfortuanetly the coding style is inconsistent. Which one
should be used?
Indentation
===========
void foo() {
int bla;
};
or
void foo() {
int bla;
};
Assignment
==========
bla= 17;
or
bla = 17;
Spacing
=======
foo(x,y,z);
for(x= 1;x<10;++x) { }
bla= blub+baz;
if(1) { }
while(1) { }
do { } while(1);
or
foo(x, y, z);
for (x= 1; x < 10; ++x) { }
bla= blub + baz;
if (1) { }
while (1) { }
do { } while (1);
Pre or Post increment
=====================
x++;
for (x= 1; x<10; x++) { }
or
++x;
for (x= 1; x<10; ++x) { }
Combined or seperate increments
===============================
*p++= 0;
or
*p = 0;
++p;
Printf formating
================
(not quite coding style but both are used)
printf("%.250s\n", package->name);
or
printf("%s\n", package->name);
Line breaks in complex conditionals
===================================
if (foo == 1 &&
bar == 2) { }
or
if (foo == 1
&& bar == 2) { }
Line length
===========
80 chars?
MfG
Goswin
PS: Maybe someone can put the answeres in README.coding-style in the
source?
Reply to: