ndt-dev - Re: [ndt-dev] c code style
Subject: NDT-DEV email list created
List archive
- From: Dominic Hamon <>
- To: Dominic Hamon <>
- Cc: Aaron Brown <>, Kavitha Kumar <>,
- Subject: Re: [ndt-dev] c code style
- Date: Fri, 9 Nov 2012 15:07:19 -0800
This should be the final version of the style changes. I have a separate patch to push the python and .sh I used.
Dominic Hamon | Measurement Lab
Dominic Hamon | Measurement Lab
On Thu, Nov 8, 2012 at 7:53 AM, Dominic Hamon <> wrote:
That rule can be filtered out, I believe, or just ignored.I'll play around with the script I used to run it and make sure that there's not too much noise. There are a few rules that give warnings I ignored as filtering them causes useful errors to be ignored, and acting on them would be more than a style change (eg - replacing long and short with uint32_t and uint16_t. Probably safe, but it's unclear that there's no unexpected knockon).
On Thu, Nov 8, 2012 at 7:35 AM, Aaron Brown <> wrote:Hey Dominic,The new style looks fine with 1 exception:#include "./usage.h"#include "./troute.h"#include "./tr-tree.h"Is there any way to get rid of that? it looks kinda hideous.Also, if you could commit the cpplint.py along with a script to run it on the codebase, that'd be good. (obviously, this commit should be separate from a commit to change the whitespace).Cheers,AaronOn Nov 6, 2012, at 12:36 PM, Dominic Hamon <> wrote:<ndt-style.patch>On Mon, Nov 5, 2012 at 1:01 PM, Aaron Brown <> wrote:
Hey Dominic,Are you making changes to cpplint.py?On Nov 5, 2012, at 3:51 PM, Dominic Hamon <> wrote:I'm looking at using cpplint.py from here but I had to do two things:1. Change the filter so it considers files with a .c extension.Yes - it's a one line change just to make it consider plain .c files. It might be worth keeping the updated version in the tree somewhere.Could you send a an existing NDT .c file, and that same file after the lint has been run.2. Use the following command line: 'cpplint.py --filter=-build/include_order,-legal/copyright,-readability/casting $file' to remove some cases that we probably don't care about.Attached patch with a number of files updated so you can see the differences.wdyt?
Dominic Hamon | Measurement Lab
On Tue, Oct 30, 2012 at 8:59 AM, Kavitha Kumar <> wrote:Hi Dominic,
Yes, you're right w.r.t the GNU style braces and indentation. Eclipse does seem to use these, so it might have been an error on my side.
Basically, our goal for formatting-style was to enable code to be easily readable, consistent, attractive to newer members of the NDT dev community, and easy to use before committing code into the repositories.
So, its of equal value if you'd prefer to change it to google or GNU style (Aaron and Nils second this on my side). But it would be great if you documented your style suggestions and include your script (if you used "indent" or so) so that everyone has access to it in future. You could add documentation to the wiki pages.
W.r.t your question about persuading GNU indent to speak google : that's easy to do in Eclipse. You can set the "code style" settings for many parameters, and can even alter default profiles like GNU/K&R to have your preferences for just a few parameters.
Thanks,
Kavitha
----- Original Message -----
> From: "Dominic Hamon" <>
> To: "Kavitha Kumar" <>
> Cc: , "Aaron Brown" <>
> Sent: Tuesday, October 30, 2012 11:23:05 AM
> Subject: Re: [ndt-dev] c code style
>
> Hi Kavitha
>
>
> I wonder if Eclipse is using some other definition of GNU style than
> the one I know[1] as it doesn't look much like GNU style. That has
> things like braces on column one for functions, structs, and enums,
> and the C code here has the braces in line with the first line of a
> block.
>
>
> The existing code has quite a bit in common with Google standard[2]
> except for the indent being mostly 8 instead of 2. Let me know if
> changing the indent is something that you're passionate about as I
> know many people are.
>
>
> I'm not sure if GNU indent can be persuaded to speak Google style,
> but it can definitely get part of the way there.
>
>
> 1. http://www.gnu.org/prep/standards/standards.html#Formatting
> 2. http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
>
>
>
> On Tue, Oct 30, 2012 at 4:21 AM, Kavitha Kumar <
> > wrote:
>
>
> Hi Dominic,
> I used the GNU style formatting for the C code. I basically got lazy
> and used Eclipse to format my code.
>
> And when I did so, I made a separate commit for the formatted code
> alone so that it was easy to "number" it with svn.
>
> HTH,
> Kavitha
>
>
>
> ----- Original Message -----
> > From: "Dominic Hamon" < >
> > To: "Aaron Brown" < >
> > Cc:
> > Sent: Monday, October 29, 2012 3:36:09 PM
> > Subject: Re: [ndt-dev] c code style
> >
> >
> >
> >
> >
> > On Mon, Oct 29, 2012 at 6:48 AM, Aaron Brown <
> > >
> > wrote:
> >
> >
> >
> > Hey Dominic,
> >
> >
> >
> >
> > On Oct 26, 2012, at 4:10 PM, Dominic Hamon wrote:
> >
> >
> >
> > Is there an existing code style for the c code in ndt? I noticed
> > that
> > some of the files seem to have odd wrapping and indenting, but that
> > might be a mistake due to merging in the past.
>
> >
> > I'd like to clean up the code formatting but I don't know what
> > style
> > to use.
> >
> > As long as it's standardized and easy to reproduce, I don't have a
> > strong opinion on the matter. My only preference would be to use
> > one
> > that minimizes the amount of change from the existing scheme (to
> > avoid unnecessary churn).
> >
> >
> > I understand. My preference would be the Google C++ style (
> > http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml )
> > which is pretty much what ndt follows, except for the indentation.
> >
> >
> > I'm happy to fix up the existing code to the style, but I
> > understand
> > that might be too much change 'just' for formatting. WDYT?
> >
> >
> >
> >
> >
> >
> >
> > Cheers,
> > Aaron
> >
> >
> > TIP2013, University of Hawaii Mānoa
> > January 13 - January 17, 2013, Honolulu, HI
> > http://events.internet2.edu/2013/tip/
> >
> >
>
>
TIP2013, University of Hawaii Mānoa
January 13 - January 17, 2013, Honolulu, HI
http://events.internet2.edu/2013/tip/TIP2013, University of Hawaii Mānoa
January 13 - January 17, 2013, Honolulu, HI
http://events.internet2.edu/2013/tip/
Attachment:
ndt-style.patch
Description: Binary data
- Re: [ndt-dev] c code style, Dominic Hamon, 11/05/2012
- Re: [ndt-dev] c code style, Aaron Brown, 11/05/2012
- Re: [ndt-dev] c code style, Dominic Hamon, 11/06/2012
- Re: [ndt-dev] c code style, Dominic Hamon, 11/07/2012
- Re: [ndt-dev] c code style, Aaron Brown, 11/08/2012
- Re: [ndt-dev] c code style, Dominic Hamon, 11/08/2012
- Re: [ndt-dev] c code style, Dominic Hamon, 11/09/2012
- Re: [ndt-dev] c code style, Dominic Hamon, 11/08/2012
- Re: [ndt-dev] c code style, Dominic Hamon, 11/06/2012
- Re: [ndt-dev] c code style, Aaron Brown, 11/05/2012
Archive powered by MHonArc 2.6.16.