Quantcast

How about resurrecting scripts/reindent?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How about resurrecting scripts/reindent?

Leland Lucius
I know my style is way bogus to most people.  I did try to follow the
existing style when I first started, but I found that it was a bit
tedious since there were already a few styles in place.  So, I made it
worse by adding my own.  :-(

I don't know...just a thought.

Leland



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How about resurrecting scripts/reindent?

dmazzoni
On Jan 14, 2006, at 9:19 PM, Leland Lucius wrote:
> I know my style is way bogus to most people.  I did try to follow the
> existing style when I first started, but I found that it was a bit
> tedious since there were already a few styles in place.  So, I made it
> worse by adding my own.  :-(

I would prefer if our C++ coding style was reasonably standardized.  
For maximum cross-platform and cross-editor compatibility, please  
always use spaces and not tabs.  The standard for Audacity is 3  
spaces of indentation, which is unusual but was chosen as a  
compromise between some people who normally use 2 and others who  
normally use 4.  Everyone seems to be able to live with 3.

Every Audacity C++ file has a magic sequence at the bottom that tells  
vi and emacs to use 3 spaces for indentation and no tabs.  It'd be  
nice if people set other editors to do the same when working on  
Audacity.

More important than any particular standard is that each file should  
be consistent.  I don't care if one particular file has four spaces,  
or if one file uses mostly K&R style brackets and the other puts the  
left and right brackets on the same column, but I don't like them  
mixed and matched in the same file, especially not in the same function!

The problem with auto-reindenting everything is that it tends to mess  
up things like macros and indented comments.  :(  So I'd prefer to do  
it on a case-by-case basis...

- Dominic


> I don't know...just a thought.
>
> Leland
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through  
> log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD  
> SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: How about resurrecting scripts/reindent?

Leland Lucius
>
> The problem with auto-reindenting everything is that it tends
> to mess up things like macros and indented comments.  :(
>
Ah yes, I'd forgotten about that.  

> So I'd  prefer to do it on a case-by-case basis...
>
Case-by-case meaning file-by-file?

As modifications are made, should a secondary task be to "standardize"
the modified file to one style?  I can certainly go back and reformat
the things I've done, but what format should be used if there's already
a couple of different ones?

Basically, which format do you code in and that's what I'll do... :-)

Leland



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How about resurrecting scripts/reindent?

dmazzoni
On Jan 15, 2006, at 1:57 AM, Leland Lucius wrote:
> Case-by-case meaning file-by-file?

Yes...only when needed.  Luckily most of us are pragmatic and realize  
that one of the strengths of Audacity is that many people with many  
different backgrounds contribute code.  As a result, we're quite  
tolerant of different coding style, as long as it's readable and not  
too unusual.

> As modifications are made, should a secondary task be to "standardize"
> the modified file to one style?  I can certainly go back and reformat
> the things I've done, but what format should be used if there's  
> already
> a couple of different ones?
>
> Basically, which format do you code in and that's what I'll do... :-)

1. Mandatory - use spaces, never tabs.  Any files you've checked in  
with tabs, please fix!
2. Strongly preferred - use 3 spaces for indentation.  Using 2 or 4  
is OK if an entire file is consistent.
3. Braces: either of the following is fine, but please be consistent  
within each method or group of methods, i.e. if you edit a file I  
wrote, please use style "A", if you edit a file Markus wrote, use  
style "B":

    A: if (condition) {
          statement;
       }
       else {
          something_else;
       }

    B: if (condition)
       {
          statement;
       } else
       {
          something_else;
       }

Exceptions: anything in lib-src is obviously allowed to have its own  
coding style!

By the way, what editor do you use?  Could you check to see if  
there's a way to provide "hints" in the file that tell it what style  
of indentation to use?

- Dominic


> Leland
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through  
> log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD  
> SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: How about resurrecting scripts/reindent?

Leland Lucius
>
> By the way, what editor do you use?  Could you check to see if  
> there's a way to provide "hints" in the file that tell it what style  
> of indentation to use?
>
On Windows I just use Visual Studio and elsewhere I prefer a little
editor called "le" (curses based).  Unfortunately, it does not work
well on the Mac (in Terminal) and I've not been able to figure it out.
So, I've opted for one called "mp" (also curses based).  I might give
in and go with Xcode or use "le" under X (it does work there).

Like you I try never to use tabs.  Having a mainframe background, I've
grown up manually indenting everything and that carried over into my
personal style.

So, from here on, I will use the 2 styles you've shown and I'll correct
the files that I've mucked up when I come across them again.

I usually try to follow existing styles when contributing to a project.
I guess I got a little carried away this time round.

Leland



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Loading...