Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 26 Jul 2015 15:50:11 +0200
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: Coding Style

Kai,

Your quoting is such that it's unclear who wrote what. ;-(  Ideally, you
should use a MUA that would automatically substitute the correct "On ...
wrote:" line when quoting, like mine does.

On Sun, Jul 26, 2015 at 08:31:38PM +0800, Kai Zhao wrote:
> >>         if (x == y) {
> >>                 ..
> >>         } else if (x > y) {
> >>                 ...
> >>         } else {
> >>                 ....
> >>         }

This is the style I think we should use.

> > IMHO we should allow this too
> >         if (x == y) {
> >                 ..
> >         }
> >         else if (x > y) {
> >                 ...
> >         }
> >         else {
> >         ....
> >        }

I think we shouldn't allow this.  Not only do I dislike it, but also we
can't allow both styles at once yet be able to use an automatic formatter
(well, unless the formatter is such that it'd preserve some properties
of the original formatting, but that's uncommon).

> There is also another style in john.
> 
> static void john_run(void)
> {
>         struct stat trigger_stat;
>         int trigger_reset = 0;
>         if (options.flags & FLG_TEST_CHK)
>                 exit_status = benchmark_all() ? 1 : 0;
>         else
>         if (options.flags & FLG_MAKECHR_CHK)
>                 do_makechars(&database, options.charset);
>         else
>         if (options.flags & FLG_CRACKING_CHK) {
>                 ...
>         }
> }

I don't mind converting this to the first style above.

> Should we allow this style too ?

I think not, especially not having "else" and "if" on separate lines.
And I don't mind introducing the extra curly braces, although in some
cases this might push lines above 80 chars, so we'd have to either
accept that or wrap them.

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.