hipl-core team mailing list archive
-
hipl-core team
-
Mailing list archive
-
Message #00095
Re: [Branch ~hipl-core/hipl/trunk] Rev 4915: More verbose debug messages.
On Sun, 29 Aug 2010 13:03:23 +0200, Diego Biurrun <diego@xxxxxxxxxx> wrote:
It should be described in the HACKING files of both PISA and HIPL.
Have you read them?
Yes but obviously not thoroughly enough :) didn't notice there's a
distinction between assignments and function calls regarding indention.
How can this be made clearer?
I'd propose this:
=== modified file 'doc/HACKING'
--- doc/HACKING 2010-05-26 13:09:00 +0000
+++ doc/HACKING 2010-08-29 13:51:58 +0000
@@ -489,12 +489,14 @@
- line length:
Long lines (>80 characters) should be broken at suitable places
- where doing so improves readability. Broken lines should not be
- mechanically indented by four spaces. Instead they should be
- indented for optimum readability. For example function arguments
- placed on the next line should align with the first character
- after the '('.
-
+ where doing so improves readability.
+ - Function calls should not be mechanically indented by four spaces.
+ Instead they should be indented for optimum readability. For example,
+ arguments placed on the next line should align with the first
+ character after the '('. If no argument fits on the current
+ line, place the opening brace on the next indented by 8 spaces.
+ - Cases not covered by the above rules, like assignments,
+ should be indented by 8 spaces.
- prettyprinting:
In cases where this improves readability, vertical alignment
around operators etc. should be applied.
@@ -525,7 +527,7 @@
/* Function declarations are broken down to avoid overly long lines. */
static void a_function_with_a_long_name(struct ip_pkt *pkt,
- struct opaque op,
+ struct opaque *op,
int value)
{
int i;
@@ -553,6 +555,23 @@
}
}
+static void blah(int a, int b) {
+ /* excessive nesting should be avoided but if it can't,
+ * remember the following rules */
+ if(a) {
+ if(b) {
+ struct opaque blah;
+
+ /* indent broken assignments by 8 spaces */
+ blah.transport_hdr.tcp = (struct tcphdr*)
+ (((char *) iphdr) + ip_hdr_len);
+
+ /* opening '(' on next line if no argument fits */
+ yet_another_function_with_a_long_name
+ (a_function_with_a_long_name(NULL, &blah, 0xC0FFEE));
+ }
+ }
+}
CODING CONVENTIONS
==================
Did I get it right this time?
Define "right". The patch you attached is not an indentation fix.
Ah yes, I was referring to indentation.
Looks fine at a glance though.
Okay.
Follow ups
References