Re: First draft of Coding standards in develop branch

2016-04-27 Thread Andrei Emeltchenko
Hi, On Mon, Apr 25, 2016 at 09:03:17PM -0700, Sterling Hughes wrote: > > >2) Should all local variables be defined at the beginning of the function? > >(my vote: yes) should it be in the beginning of scope? like: myfunc { ... { int i = 0; } } Best

Re: First draft of Coding standards in develop branch

2016-04-26 Thread will sanfilippo
> On Apr 26, 2016, at 8:28 AM, Christopher Collins wrote: > > On Sun, Apr 24, 2016 at 10:08:09AM -0700, Sterling Hughes wrote: >> Hi, >> >> As we start to bring on new contributors, and operate as a project, its >> increasingly important that we document and agree upon

Re: First draft of Coding standards in develop branch

2016-04-26 Thread Christopher Collins
I am not sure I would put it that way. The POSIX headers are part of the "implementation," so they are permitted to use the reserved namespace. Since mynewt code needs to build in sim (POSIX) and also freestanding implementations, it is probably best to respect both standards in our code. Chris

Re: First draft of Coding standards in develop branch

2016-04-26 Thread Sterling Hughes
On 4/26/16 9:22 AM, Christopher Collins wrote: On Tue, Apr 26, 2016 at 09:06:37AM -0700, Sterling Hughes wrote: I think we do need a naming convention here - I'm fine adopting H_*. I'll point out that almost every POSIX or LIBC header I've ever seen uses underscore, and I believe this is only

Re: First draft of Coding standards in develop branch

2016-04-26 Thread Christopher Collins
On Tue, Apr 26, 2016 at 09:06:37AM -0700, Sterling Hughes wrote: > I think we do need a naming convention here - I'm fine adopting H_*. > I'll point out that almost every POSIX or LIBC header I've ever seen > uses underscore, and I believe this is only reserved in C++ -- that > said, we need to

Re: First draft of Coding standards in develop branch

2016-04-26 Thread Sterling Hughes
On 4/26/16 8:28 AM, Christopher Collins wrote: On Sun, Apr 24, 2016 at 10:08:09AM -0700, Sterling Hughes wrote: Hi, As we start to bring on new contributors, and operate as a project, its increasingly important that we document and agree upon coding standards. I think we've done a good

Re: First draft of Coding standards in develop branch

2016-04-26 Thread Christopher Collins
On Sun, Apr 24, 2016 at 10:08:09AM -0700, Sterling Hughes wrote: > Hi, > > As we start to bring on new contributors, and operate as a project, its > increasingly important that we document and agree upon coding standards. > I think we've done a good job of maintaining this consistency >

Re: First draft of Coding standards in develop branch

2016-04-26 Thread Johan Hedberg
Hi, On Mon, Apr 25, 2016, will sanfilippo wrote: > > 9) I think the 79 character line length is not really helpful. I¹d rather > > see slightly longer lines. I often prefer To use longer names for example > > int res = hal_adc_get_resolution_mvolts(padc) to make it clear what is > > going on

Re: First draft of Coding standards in develop branch

2016-04-26 Thread will sanfilippo
> On Apr 25, 2016, at 9:22 PM, p...@wrada.com wrote: > > > My notes. Only a few strong opinions. > > 0) Way to go Sterling. Better sooner than later for this. > 1) when I was writing the hal I wrote a hal/hal_adc.h (public API) and > mcu/hal_adc.h (private API name for the BSP to set MCU

Re: First draft of Coding standards in develop branch

2016-04-25 Thread Sterling Hughes
On 4/25/16 8:57 PM, will sanfilippo wrote: Argh! I thought I had the stupid editor set to insert spaces for tabs. Dang! Oh well, at least you got the point :-) * I would vote for macros all uppercase. * I feel strongly about define alignment but not so much about alignment within structure

Re: First draft of Coding standards in develop branch

2016-04-25 Thread will sanfilippo
Argh! I thought I had the stupid editor set to insert spaces for tabs. Dang! Oh well, at least you got the point :-) * I would vote for macros all uppercase. * I feel strongly about define alignment but not so much about alignment within structure definitions although I think I align things in

Re: First draft of Coding standards in develop branch

2016-04-24 Thread Vipul Rahane
Hello, The document is really nice and keeps the code clean avoiding any syntactical inconsistencies. Some of the previous companies I worked at followed MISRA C coding standards which was sought after by the automotive industry mostly in the UK. Do we want to take a look at it and think of

First draft of Coding standards in develop branch

2016-04-24 Thread Sterling Hughes
Hi, As we start to bring on new contributors, and operate as a project, its increasingly important that we document and agree upon coding standards. I think we've done a good job of maintaining this consistency informally, but, now we need to vote and agree on project standards. I've taken