coding style, indentation, etc

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

coding style, indentation, etc

Radu B. Rusu
Administrator
Hi all,

Similar to the compile braindump from yesterday, here's another page (linked to the main pcl.ros.org web site) for
developers: http://www.ros.org/wiki/pcl/CodingStyleGuide

Please add your comments/ideas. Let's make this a resource for future developers.
--
Cheers,
Radu.

_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Geoffrey Biggs
Apart from wondering why the two spaces before the function name at the
start of a line, I have no comments. :)

Geoff

On 30/11/10 05:20, Radu Bogdan Rusu wrote:
> Hi all,
>
> Similar to the compile braindump from yesterday, here's another page (linked to the main pcl.ros.org web site) for
> developers: http://www.ros.org/wiki/pcl/CodingStyleGuide
>
> Please add your comments/ideas. Let's make this a resource for future developers.
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Alex Bravo
In reply to this post by Radu B. Rusu
Hi,
 
While I do like changes to Style guide PCL is proposing, it's pretty strange to have two separate C++ style guides on one ROS.org site (or is it three styles? Does OpenCV have its own style?).
I believe it would be very desirable to come up with a concensus and have only one C++ Style Guide.
 
Alex
 
 
Date: Mon, 29 Nov 2010 12:20:12 -0800
From: Radu Bogdan Rusu <[hidden email]>
Subject: [PCL-users] coding style, indentation, etc
To: "Point Cloud Library (PCL) mailing list" <[hidden email]>
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi all,

Similar to the compile braindump from yesterday, here's another page (linked to the main pcl.ros.org web site) for
developers: http://www.ros.org/wiki/pcl/CodingStyleGuide

Please add your comments/ideas. Let's make this a resource for future developers.
--
Cheers,
Radu.


_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Radu B. Rusu
Administrator
Yup, OpenCV has its own style. The ROS C++ style is _unfortunately_ not truly adopted by all ROS packages, which makes
looking at the code a pain sometimes.

We're 99.99% identical to ROS C++, with two tiny additions regarding indentation. Since we're a smaller project that
aims to works independent of ROS too, we can afford to control these things much better than the ROS package universe.
This will hopefully lead to cleaner, more readable code (to some extent) in PCL.

Cheers,
Radu.


On 11/30/2010 01:09 PM, Alex Bravo wrote:

> Hi,
> While I do like changes to Style guide PCL is proposing, it's pretty strange to have two separate C++ style guides on
> one ROS.org site (or is it three styles? Does OpenCV have its own style?).
> I believe it would be very desirable to come up with a concensus and have only one C++ Style Guide.
> Alex
> Date: Mon, 29 Nov 2010 12:20:12 -0800
> From: Radu Bogdan Rusu <[hidden email] <mailto:[hidden email]>>
> Subject: [PCL-users] coding style, indentation, etc
> To: "Point Cloud Library (PCL) mailing list" <[hidden email] <mailto:[hidden email]>>
> Message-ID: <[hidden email] <mailto:[hidden email]>>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi all,
>
> Similar to the compile braindump from yesterday, here's another page (linked to the main pcl.ros.org
> <http://pcl.ros.org> web site) for
> developers: http://www.ros.org/wiki/pcl/CodingStyleGuide
>
> Please add your comments/ideas. Let's make this a resource for future developers.
> --
> Cheers,
> Radu.
>
>
>
> _______________________________________________
> [hidden email] / http://pcl.ros.org
> https://code.ros.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Troy Straszheim
On Tue, Nov 30, 2010 at 1:20 PM, Radu Bogdan Rusu <[hidden email]> wrote:
Yup, OpenCV has its own style. The ROS C++ style is _unfortunately_ not truly adopted by all ROS packages, which makes
looking at the code a pain sometimes.

We're 99.99% identical to ROS C++, with two tiny additions regarding indentation. Since we're a smaller project that
aims to works independent of ROS too, we can afford to control these things much better than the ROS package universe.
This will hopefully lead to cleaner, more readable code (to some extent) in PCL.

Cheers,
Radu.


That two-space function name thing is new to me.  I admit I'm generally suspicious of coding standards that legislate indentation and braces too much.   (See sutter/alexandrescu "C++ coding standards" page 3).    I'm curious...  what is the rationale for the two spaces?

-t



_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Radu B. Rusu
Administrator
If that's the second bullet point, I'm prepared to drop it. I find the code looks nicer and easier to understand, but
maybe that's just due to my background (people that I worked with in the past tended to use that, so it stuck -- don't
remember what projects it originally came from). I do like the return type on a new line though.


Cheers,
Radu.


On 11/30/2010 02:29 PM, Troy Straszheim wrote:

> On Tue, Nov 30, 2010 at 1:20 PM, Radu Bogdan Rusu <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Yup, OpenCV has its own style. The ROS C++ style is _unfortunately_ not truly adopted by all ROS packages, which makes
>     looking at the code a pain sometimes.
>
>     We're 99.99% identical to ROS C++, with two tiny additions regarding indentation. Since we're a smaller project that
>     aims to works independent of ROS too, we can afford to control these things much better than the ROS package universe.
>     This will hopefully lead to cleaner, more readable code (to some extent) in PCL.
>
>     Cheers,
>     Radu.
>
>
> That two-space function name thing is new to me.  I admit I'm generally suspicious of coding standards that legislate
> indentation and braces too much.   (See sutter/alexandrescu "C++ coding standards" page 3).    I'm curious...  what is
> the rationale for the two spaces?
>
> -t
>
>
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Patrick Mihelich
I vote for dropping the second bullet point. Honestly it breaks the way my eyes scan function signatures. I noticed it in the kinect code and it threw me off.

I don't particularly object to the first bullet point, but I think it's getting into the realm of micro-management.

Patrick

On Tue, Nov 30, 2010 at 2:33 PM, Radu Bogdan Rusu <[hidden email]> wrote:
If that's the second bullet point, I'm prepared to drop it. I find the code looks nicer and easier to understand, but
maybe that's just due to my background (people that I worked with in the past tended to use that, so it stuck -- don't
remember what projects it originally came from). I do like the return type on a new line though.


Cheers,
Radu.


On 11/30/2010 02:29 PM, Troy Straszheim wrote:
> On Tue, Nov 30, 2010 at 1:20 PM, Radu Bogdan Rusu <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Yup, OpenCV has its own style. The ROS C++ style is _unfortunately_ not truly adopted by all ROS packages, which makes
>     looking at the code a pain sometimes.
>
>     We're 99.99% identical to ROS C++, with two tiny additions regarding indentation. Since we're a smaller project that
>     aims to works independent of ROS too, we can afford to control these things much better than the ROS package universe.
>     This will hopefully lead to cleaner, more readable code (to some extent) in PCL.
>
>     Cheers,
>     Radu.
>
>
> That two-space function name thing is new to me.  I admit I'm generally suspicious of coding standards that legislate
> indentation and braces too much.   (See sutter/alexandrescu "C++ coding standards" page 3).    I'm curious...  what is
> the rationale for the two spaces?
>
> -t
>
>
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Radu B. Rusu
Administrator
Done! :) Updated http://www.ros.org/wiki/pcl/CodingStyleGuide.

Thanks,
Radu.


On 11/30/2010 02:56 PM, Patrick Mihelich wrote:

> I vote for dropping the second bullet point. Honestly it breaks the way my eyes scan function signatures. I noticed it
> in the kinect code and it threw me off.
>
> I don't particularly object to the first bullet point, but I think it's getting into the realm of micro-management.
>
> Patrick
>
> On Tue, Nov 30, 2010 at 2:33 PM, Radu Bogdan Rusu <[hidden email] <mailto:[hidden email]>> wrote:
>
>     If that's the second bullet point, I'm prepared to drop it. I find the code looks nicer and easier to understand, but
>     maybe that's just due to my background (people that I worked with in the past tended to use that, so it stuck -- don't
>     remember what projects it originally came from). I do like the return type on a new line though.
>
>
>     Cheers,
>     Radu.
>
>
>     On 11/30/2010 02:29 PM, Troy Straszheim wrote:
>      > On Tue, Nov 30, 2010 at 1:20 PM, Radu Bogdan Rusu <[hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>      >
>      >     Yup, OpenCV has its own style. The ROS C++ style is _unfortunately_ not truly adopted by all ROS packages,
>     which makes
>      >     looking at the code a pain sometimes.
>      >
>      >     We're 99.99% identical to ROS C++, with two tiny additions regarding indentation. Since we're a smaller
>     project that
>      >     aims to works independent of ROS too, we can afford to control these things much better than the ROS package
>     universe.
>      >     This will hopefully lead to cleaner, more readable code (to some extent) in PCL.
>      >
>      >     Cheers,
>      >     Radu.
>      >
>      >
>      > That two-space function name thing is new to me.  I admit I'm generally suspicious of coding standards that legislate
>      > indentation and braces too much.   (See sutter/alexandrescu "C++ coding standards" page 3).    I'm curious...
>       what is
>      > the rationale for the two spaces?
>      >
>      > -t
>      >
>      >
>     _______________________________________________
>     [hidden email] <mailto:[hidden email]> / http://pcl.ros.org
>     https://code.ros.org/mailman/listinfo/pcl-users
>
>
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Bastian Steder
In reply to this post by Patrick Mihelich
Hi all,

I have to admit, I am not a big fan of the space before function
brackets and the return type in an extra line. I'm willing to adapt of
course, but my vote would be to at least leave the first point up to
everyone's personal style.

Cheers,
Bastian



On 11/30/2010 11:56 PM, Patrick Mihelich wrote:

> I vote for dropping the second bullet point. Honestly it breaks the way
> my eyes scan function signatures. I noticed it in the kinect code and it
> threw me off.
>
> I don't particularly object to the first bullet point, but I think it's
> getting into the realm of micro-management.
>
> Patrick
>
> On Tue, Nov 30, 2010 at 2:33 PM, Radu Bogdan Rusu <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     If that's the second bullet point, I'm prepared to drop it. I find
>     the code looks nicer and easier to understand, but
>     maybe that's just due to my background (people that I worked with in
>     the past tended to use that, so it stuck -- don't
>     remember what projects it originally came from). I do like the
>     return type on a new line though.
>
>
>     Cheers,
>     Radu.
>
>
>     On 11/30/2010 02:29 PM, Troy Straszheim wrote:
>      > On Tue, Nov 30, 2010 at 1:20 PM, Radu Bogdan Rusu
>     <[hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>      >
>      >     Yup, OpenCV has its own style. The ROS C++ style is
>     _unfortunately_ not truly adopted by all ROS packages, which makes
>      >     looking at the code a pain sometimes.
>      >
>      >     We're 99.99% identical to ROS C++, with two tiny additions
>     regarding indentation. Since we're a smaller project that
>      >     aims to works independent of ROS too, we can afford to
>     control these things much better than the ROS package universe.
>      >     This will hopefully lead to cleaner, more readable code (to
>     some extent) in PCL.
>      >
>      >     Cheers,
>      >     Radu.
>      >
>      >
>      > That two-space function name thing is new to me.  I admit I'm
>     generally suspicious of coding standards that legislate
>      > indentation and braces too much.   (See sutter/alexandrescu "C++
>     coding standards" page 3).    I'm curious...  what is
>      > the rationale for the two spaces?
>      >
>      > -t
>      >
>      >
>     _______________________________________________
>     [hidden email] <mailto:[hidden email]> /
>     http://pcl.ros.org
>     https://code.ros.org/mailman/listinfo/pcl-users
>
>
>
>
> _______________________________________________
> [hidden email] / http://pcl.ros.org
> https://code.ros.org/mailman/listinfo/pcl-users


--
Bastian Steder

Albert-Ludwigs-University
Institute of Computer Science
Autonomous Intelligent Systems
Georges-Koehler-Allee 079
D-79110 Freiburg, Germany

Phone:  +49 (761) 203-8013
Fax  :  +49 (761) 203-8007
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Radu B. Rusu
Administrator

On 12/01/2010 01:40 AM, Bastian Steder wrote:
> Hi all,
>
> I have to admit, I am not a big fan of the space before function
> brackets and the return type in an extra line. I'm willing to adapt of
> course, but my vote would be to at least leave the first point up to
> everyone's personal style.

We know that indentation starts as many flamewars as discussions about vim vs emacs. I think we can only hope that the
guidelines get adopted, at least by new users/developers who might not feel as strongly about indentation, etc, as
others. :) Obviously, we cannot _really_ force anyone (what would we do? not except a good patch because it's not
indented properly? :D).

I just hope we do a better job (since we're smaller) and get our code to be more consistent than other packages in ROS,
where most folks haven't even read the preferred ROS C++ style guide document.

Btw, we should add more content to the guide, regarding our preferred way of designing the API too. The document should
really be more than just indentation.

PS. Basti, if you do re-indent your existing code in PCL to some extent, that would be awesome! :) We haven't touched it
until now -- I was personally afraid of all the leftover commented in parts :)

Cheers,
Radu.
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Troy Straszheim
On Wed, Dec 1, 2010 at 8:57 AM, Radu Bogdan Rusu <[hidden email]> wrote:

On 12/01/2010 01:40 AM, Bastian Steder wrote:
> Hi all,
>
> I have to admit, I am not a big fan of the space before function
> brackets and the return type in an extra line. I'm willing to adapt of
> course, but my vote would be to at least leave the first point up to
> everyone's personal style.

We know that indentation starts as many flamewars as discussions about vim vs emacs. I think we can only hope that the
guidelines get adopted, at least by new users/developers who might not feel as strongly about indentation, etc, as
others. :) Obviously, we cannot _really_ force anyone (what would we do? not except a good patch because it's not
indented properly? :D).

The LLVM guys would.   I implemented some new plugin features for clang and fixed a couple of bugs...  I had to submit the first patch three or four times before it was accepted.  This was a Good Thing from my point of view:  I learned about their coding standards and gained experience with their community, and they got the perfect patch.   Side note:  that the core LLVM developers are usually on IRC is a big, big help, as this can be much more efficient than email when quick iterations/discussion are required.  

LLVM/clang coding standards:


Again, note that the sutter/alexrandescu standards item 0 is 'dont sweat the small stuff'.  If you attempt to legislate things that arent enforceable, to some degree this will discredit the entire coding standard in the eyes of those who know what isn't enforceable.


I just hope we do a better job (since we're smaller) and get our code to be more consistent than other packages in ROS,
where most folks haven't even read the preferred ROS C++ style guide document.

Btw, we should add more content to the guide, regarding our preferred way of designing the API too. The document should
really be more than just indentation.

PS. Basti, if you do re-indent your existing code in PCL to some extent, that would be awesome! :) We haven't touched it
until now -- I was personally afraid of all the leftover commented in parts :)


The one that I would most like to see adopted is the 80 character width limit... trying to hack on code with 200 character long lines (because the author places one or two gigantic editor windows on their 30" screen) is a huge nuisance.     Break code up over more lines, it shows the structure better.

-t


_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Radu B. Rusu
Administrator


On 12/01/2010 12:15 PM, Troy Straszheim wrote:
>
> The one that I would most like to see adopted is the 80 character width limit... trying to hack on code with 200
> character long lines (because the author places one or two gigantic editor windows on their 30" screen) is a huge
> nuisance.     Break code up over more lines, it shows the structure better.

It would be awesome to impose a 30" screen requirement for PCL users :)

"Uhmmm... because you need to see your PointClouds bigger?" :)


Cheers,
Radu.
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Jack O'Quin
In reply to this post by Troy Straszheim
On Wed, Dec 1, 2010 at 2:15 PM, Troy Straszheim
<[hidden email]> wrote:

> The one that I would most like to see adopted is the 80 character width
> limit... trying to hack on code with 200 character long lines (because the
> author places one or two gigantic editor windows on their 30" screen) is a
> huge nuisance.     Break code up over more lines, it shows the structure
> better.

+1

That is the only "coding standard" that I seriously care about.
--
 joq
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Radu B. Rusu
Administrator
Awesome, let's add that to the list (edit the wiki please), and we'll try to indent the existing code and make the new
code conform to this standard.

Is 80 ok or 120 though? I feel like 80 is old and has a historical meaning (80x25 consoles)... nowadays we can easily do
better with 120.

Cheers,
Radu.


On 12/01/2010 01:15 PM, Jack O'Quin wrote:

> On Wed, Dec 1, 2010 at 2:15 PM, Troy Straszheim
> <[hidden email]>  wrote:
>
>> The one that I would most like to see adopted is the 80 character width
>> limit... trying to hack on code with 200 character long lines (because the
>> author places one or two gigantic editor windows on their 30" screen) is a
>> huge nuisance.     Break code up over more lines, it shows the structure
>> better.
>
> +1
>
> That is the only "coding standard" that I seriously care about.
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Troy Straszheim
On Wed, Dec 1, 2010 at 1:23 PM, Radu Bogdan Rusu <[hidden email]> wrote:

>
> Awesome, let's add that to the list (edit the wiki please), and we'll try to indent the existing code and make the new
> code conform to this standard.
>
> Is 80 ok or 120 though? I feel like 80 is old and has a historical meaning (80x25 consoles)... nowadays we can easily do
> better with 120.
>
> Cheers,
> Radu.
>

My thinking mirrors LLVM/Clang's:

[quote]
Source Code Width

Write your code to fit within 80 columns of text. This helps those of
us who like to print out code and look at your code in an xterm
without resizing it.

The longer answer is that there must be some limit to the width of the
code in order to reasonably allow developers to have multiple files
side-by-side in windows on a modest display. If you are going to pick
a width limit, it is somewhat arbitrary but you might as well pick
something standard. Going with 90 columns (for example) instead of 80
columns wouldn't add any significant value and would be detrimental to
printing out code. Also many other projects have standardized on 80
columns, so some people have already configured their editors for it
(vs something else, like 90 columns).

This is one of many contentious issues in coding standards, but is not
up for debate.
[/quote]

Put multiple editor windows side-by-side... 80 is a good number.  The
occasional wrap is not a capital offense, but 120 wastes a lot of
screen real estate, all the time.

> On 12/01/2010 01:15 PM, Jack O'Quin wrote:
> >
> > +1
> >
> > That is the only "coding standard" that I seriously care about.
> _______________________________________________

<fistbump>

-t
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Michael Dixon
In reply to this post by Radu B. Rusu
Hello all,

I haven't chimed in before on these discussions, but since I've been
doing a little pcl development and plan to do more in the future, I
thought I'd add my two cents on this topic.  I'm a big fan of 120
characters over 80.  I know it gets harder to put two windows
side-by-side with a larger line limit, but I believe 120 is what the
ROS style guide specifies, and I find an 80 character limit can lead
to some awkward line breaks.  Especially since our existing code has a
lot of templated classes, and our method declarations sometimes end up
looking something like:

template <typename PointInT, typename PointNormalT, typename PointOutT> void
pcl::AwesomeFeatureEstimation<PointInT, PointNormalT,
PointOutT>::doSomethingAwesome
(const boost::shared_ptr<pcl::PointCloud<PointInT> &input,
pcl::PointCloud<PointOutT> &output)
{
....

In situations like this one, I personally think an extra 40 characters
can really help avoid weird line-breaks.  And in general, I've always
been more bothered by awkward line-breaks than by wasted screen space.


Michael


On Wed, Dec 1, 2010 at 3:23 PM, Radu Bogdan Rusu <[hidden email]> wrote:

> Awesome, let's add that to the list (edit the wiki please), and we'll try to indent the existing code and make the new
> code conform to this standard.
>
> Is 80 ok or 120 though? I feel like 80 is old and has a historical meaning (80x25 consoles)... nowadays we can easily do
> better with 120.
>
> Cheers,
> Radu.
>
>
> On 12/01/2010 01:15 PM, Jack O'Quin wrote:
>> On Wed, Dec 1, 2010 at 2:15 PM, Troy Straszheim
>> <[hidden email]>  wrote:
>>
>>> The one that I would most like to see adopted is the 80 character width
>>> limit... trying to hack on code with 200 character long lines (because the
>>> author places one or two gigantic editor windows on their 30" screen) is a
>>> huge nuisance.     Break code up over more lines, it shows the structure
>>> better.
>>
>> +1
>>
>> That is the only "coding standard" that I seriously care about.
> _______________________________________________
> [hidden email] / http://pcl.ros.org
> https://code.ros.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Brian Gerkey
On Wed, Dec 1, 2010 at 1:52 PM, Michael Dixon <[hidden email]> wrote:
> I haven't chimed in before on these discussions, but since I've been
> doing a little pcl development and plan to do more in the future, I
> thought I'd add my two cents on this topic.  I'm a big fan of 120
> characters over 80.  I know it gets harder to put two windows
> side-by-side with a larger line limit, but I believe 120 is what the
> ROS style guide specifies, and I find an 80 character limit can lead
> to some awkward line breaks.

I'm a big proponent of the 80-character limit, and that's what I
originally wrote into the ROS developers' guide.  It was later, under
pressure from many people, that I upped it to 120.  I don't intend to
move it further.  And I still personally use 80.

        brian.
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Geoffrey Biggs
On 02/12/10 07:23, Brian Gerkey wrote:

> On Wed, Dec 1, 2010 at 1:52 PM, Michael Dixon <[hidden email]> wrote:
>> I haven't chimed in before on these discussions, but since I've been
>> doing a little pcl development and plan to do more in the future, I
>> thought I'd add my two cents on this topic.  I'm a big fan of 120
>> characters over 80.  I know it gets harder to put two windows
>> side-by-side with a larger line limit, but I believe 120 is what the
>> ROS style guide specifies, and I find an 80 character limit can lead
>> to some awkward line breaks.
>
> I'm a big proponent of the 80-character limit, and that's what I
> originally wrote into the ROS developers' guide.  It was later, under
> pressure from many people, that I upped it to 120.  I don't intend to
> move it further.  And I still personally use 80.

I'm another 80-character fan (actually, I use 79, for Python code on the
advice of the Python style guide and since I edit Python and C++ in the
same editor...). I dislike 120 characters. I used to use it, then I got
my nice portable laptop with its 12" screen and fast processor. Two
80-column windows in vim just fit side-by-side, a single 120-column
window wastes 25% of my screen space. 80 columns is definitely not a
legacy thing for me.

Speaking of the Python style guide, everyone should read the first
section after the intro.

http://www.python.org/dev/peps/pep-0008/

Geoff
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Geoffrey Biggs
In reply to this post by Radu B. Rusu
On 02/12/10 01:57, Radu Bogdan Rusu wrote:

>
> On 12/01/2010 01:40 AM, Bastian Steder wrote:
>> Hi all,
>>
>> I have to admit, I am not a big fan of the space before function
>> brackets and the return type in an extra line. I'm willing to adapt of
>> course, but my vote would be to at least leave the first point up to
>> everyone's personal style.
>
> We know that indentation starts as many flamewars as discussions about vim vs emacs. I think we can only hope that the
> guidelines get adopted, at least by new users/developers who might not feel as strongly about indentation, etc, as
> others. :) Obviously, we cannot _really_ force anyone (what would we do? not except a good patch because it's not
> indented properly? :D).

Reformat it (without introducing new bugs, of course). That's what I do
for Player patches that are really really badly formatted. Keeping the
code base maintainable relies more than most think on keeping the code
readable. "Code is read much more often than it is written," as the
Python creator said.

Geoff
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: coding style, indentation, etc

Bastian Steder
In reply to this post by Radu B. Rusu
I am very much in favor of the 120 characters. As already pointed out,
with all the templates etc. 80 chars would just be a pain.
I just had a look at some of my code and 120 seems to be a quite natural
maximum length.

Cheers,
Bastian

On 12/01/2010 10:23 PM, Radu Bogdan Rusu wrote:
> Awesome, let's add that to the list (edit the wiki please), and we'll try to indent the existing code and make the new
> code conform to this standard.
>
> Is 80 ok or 120 though? I feel like 80 is old and has a historical meaning (80x25 consoles)... nowadays we can easily do
> better with 120.
>
> Cheers,
> Radu.
_______________________________________________
[hidden email] / http://pcl.ros.org
https://code.ros.org/mailman/listinfo/pcl-users
12