Re: [RFC] Balsa coding style

In my experience, when a code base gets to the state of, "The coding style used in <some code base> is 
currently is a bit of a mess." There is no good solution. The choices are two, IMHO.

First: live with it, and suffer the consequences of difficult readability.
Second, choose a C formatter with a style base that permits enforcement, and go with that. 

In my experience, the second has advantages that outweigh the difficulties. Then again, I'm not the one who 
has to deal with the problems. :-)

On 02/20/2016 08:59:05 AM, Albrecht Dreß wrote:
Hi all,

the balsa 'HACKING' file states

The coding style used in Balsa currently is a bit of a mess.

which is actually true... ;-)  I use Eclipse as development platform,
and could not find a setting which displays /all/ files properly.

The same document states that the indent command

      indent -kr -i4 -psl

shall be used which seems to limit the line length to 72.  This was
actually suitable for a 1024x768 screen, but seems to be too limited
these days IMHO.  Actually, the short line wrapping makes reading the
code very difficult.

What do you think about extending the indent statement above to a line
length of, say, 132, and fixing the tab width to e.g. 4, i.e.:

      indent -kr -i4 -l132 -lc132 -ts4 -psl

and re-indent all files in the repository?

An other approach would be some re-factoring, e.g. replace complex
statements like

      if (!
          (key =
           get_key_from_name(ctx, name, FALSE, accept_low_trust,
                             error))) {


      key = get_key_from_name(ctx, name, FALSE, accept_low_trust,
      if (key == NULL) {

but this implies the risk to introduce errors.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]