Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 15 Jul 2011 19:23:38 +0400
From: Aleksey Cherepanov <>
Subject: Re: coding styles for c/c++? indenter? emacs settings?

Thanks alot!

> With nested loops fully sharing their body, I often only indent the body
> by one tab, like:

It was interesting for me when i looked through John's code. Now i think
it looks nice.

I tried to use indent with john-1.7.8 sources and look for
differences. I think it is possible to add -ncs key
(--no-space-after-casts) to indent command. For instance following
string will not be changed by indent:
 		value = (int)atoi16[ARCH_INDEX(ciphertext[index + 4])] << 4;

But indent does not do it really good:
-		if (mask == ~(ARCH_WORD)0) goto next_depth;
+		if (mask == ~(ARCH_WORD) 0)
+			goto next_depth;

In this example indent seems to not understand that '(ARCH_WORD)' is a

Also this example shows that short if statements are not splitted. I saw
such lines several times and i even found 'if (cond) stat; else stat;'
on one line ("grep if *.c | grep '; else'" in john's src directory). I
do not know how to tell indent to keep such lines.

By the way indent gives errors on rules.c:
$ indent rules.c
indent: rules.c:347: Error:Stmt nesting error.
indent: rules.c:354: Error:Stmt nesting error.
indent: rules.c:868: Error:Stmt nesting error.
indent: rules.c:973: Error:Unexpected end of file

Also i found Qt's coding style at . Hence the question
what style should be used for code using Qt? For instance what style
should be used for Johnny development?

Aleksey Cherepanov

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.