Hi Samisa,
Thanks for taking the initiative. I think it's good to automate the styling.
Used the right way, it would make the code easily readable.
I like the indent that you have proposed except for few things that I have
mentioned below.
1. Why are we using 100 as the line length? It is 80 in almost all the other
projects. I know that it is not a big issue when running vi or such other
editor in the X mode, but I think this may lead to code containing a few really
long and sparse lines. And possibly problems viewing the code in other
environments. I would prefer sticking to 80 as it has been used for a long time
as a rule of thumb and it seems to have worked :)
2. I think the programmer needs to have more control over line breaks. For
instant, if I use the indent that you have given, as it is, for the following
fragment of code:
axiom_namespace_t **tmp_stack = (axiom_namespace_t **)
(AXIS2_MALLOC(ctx->env->allocator, sizeof(axiom_namespace_t *) * size));
it gives
axiom_namespace_t **tmp_stack =
(axiom_namespace_t
**) (AXIS2_MALLOC(ctx->env->allocator, sizeof(axiom_namespace_t *) * size));
this happens because of the given parameter -nhnl, not to honour the new lines.
Using -hnl instead, the code stays as it is in the original and it looks better
to me.
So basically, I am +1 for this indent with -nhnl changed to -hnl and -l100 to
-l80.
Regards,
Dumindu.
Samisa Abeysinghe wrote:
Hi All,
It would be good to get a bit more serious about the coding convention.
I revisited indent and came up with a set of options that I think we
can all agree to.
Here is the indent options for .c files:
indent -ts4 -nut -nbad -bap -nbbo -bc -bl -bli0 -bls -c33 -cd33 -ncdb
-nce -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -nhnl -i4 -ip4 -l100 -lp -ci4
-pi4 -npcs -nprs -psl -saf -sai -saw -nsc -sob -nss -bfda
For .h files, this cannot be used as it is. However I was able to come
up with some commands that would help achieve success with .h files:
indent -ts4 -nut -nbad -bap -nbbo -bc -bl -bli0 -bls -c33 -cd33 -ncdb
-nce -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -nhnl -i8 -
ip4 -l100 -lp -ci4 -npcs -nprs -psl -saf -sai -saw -nsc -sob -nss -bfda
-bbb
sed -i "s/AXIS2_CALL/AXIS2_CALL\n /g"
sed -i "s/ AXIS2_EXTERN/AXIS2_EXTERN/g"
astyle --style=ansi -b -p -s4 -M0 -c -U -S
Yes I know that is a bit of a hassle, but at least we can automate to
some extent.
Please run this and voice your opinion on this style. I think it would
be important that we should be able to run a script and fix formatting
problems. At the same time, I always believe that the developers can
help by writing it correct in the first place.
Thanks,
Samisa...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]