Date: Fri, 15 Jul 2011 19:45:46 +0400 From: Solar Designer <solar@...nwall.com> To: john-dev@...ts.openwall.com Subject: Re: coding styles for c/c++? indenter? emacs settings? Aleksey, Shinnok, all - On Fri, Jul 15, 2011 at 07:23:38PM +0400, Aleksey Cherepanov wrote: > 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. Agreed. Thanks! > But indent does not do it really good: > - if (mask == ~(ARCH_WORD)0) goto next_depth; > + if (mask == ~(ARCH_WORD) 0) > + goto next_depth; BTW, I don't mind moving goto onto the next line in these cases - this is probably a better thing to do, and I am doing it myself in newer code I write. > In this example indent seems to not understand that '(ARCH_WORD)' is a > cast. Yes, that's not great. > 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. Some of these are just my older style, which I no longer use. Some I would write this way now as well. > 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 I think it's confused by the macros. > Also i found Qt's coding style at > http://developer.qt.nokia.com/wiki/Qt_Coding_Style . Hence the question > what style should be used for code using Qt? For instance what style > should be used for Johnny development? Shinnok is the one to comment on this. If he's involved in that project, and he intends to be, his opinion is more important than mine. Thanks, Alexander
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.