[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C++: Indenting and formatting program sources.

> On 18-Nov-2001 Shaul Karl wrote:
> > Can anyone recommend a program to indent and format C++ program sources 
> > for consistency of style and perhaps better readability?
> > Specifying the used options or attaching a suitable configuration file 
> > (like a .ident.pro for GNU indent) is desirable.
> > 
> > GNU indent does not targeted directly to C++ code. Is this a problem?
> > The only official deb that I found for this task is astyle. I have not 
> > tried it yet. Are there others? Are there commonly used programs for 
> > this task that are not debianized?
> > The LDP C-C++ Beautifier HOW-TO mentions bcpp. Is it commonly used?
> > 
> > Is there a way to have vim force a standard and consistent style? Once 
> > again, attaching a configuration file or pointing out to a standard one 
> > is desirable.
> indent is the most common, followed by astyle (Artistic Style).  Both wil do
> what you want.

Quoting indent info pages bug section:

       While an attempt was made to get `indent' working for C++, is 
    not do a good job on any C++ source except the very simple.

This is also emphasized in /usr/share/doc/indent/README:

[16:39:25 tmp]$ zgrep C++ /usr/share/doc/indent/README
  GNU indent does NOT work for C++, if it does for you then you're
  just lucky.  Don't ask for support for C++.
[16:39:43 tmp]$

> vim can be almost made to do it.


    Shaul Karl
    email: shaulka (replace these parenthesis with @) bezeqint,
           delete the comma and the white space characters and add .net

Reply to: