Berkeley CSUA MOTD:Entry 11383
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/24 [General] UID:1000 Activity:popular
5/24    

2003/12/10-11 [Uncategorized] UID:11383 Activity:nil
12/9    Any comments on the artistic style formatter (astyle.sf.net)?
        Flexible?  Consistent?  Better alternatives?  This is for C++.
Cache (1236 bytes)
astyle.sf.net -> astyle.sourceforge.net/
When indenting source code, we as programmers have a tendency to use both spaces and tab characters to create the wanted indentation. Moreover, some editors by default insert spaces instead of tabs when pressing the tab key, and other editors (Emacs for example) have the ability to "pretty up" lines by automatically setting up the white space before the code on the line, possibly inserting spaces in a code that up to now used only tabs for indentation. Since the number of space characters showed on screen for each tab character in the source code changes between editors (unless manually configured by the user), one of the standard problems programmers are facing when moving source code from one editor to another is that code containing both spaces and tabs, which was up to now perfectly indented, suddently becomes a mess to look at. Even if you take care to ONLY use spaces or tabs, looking at other peoples source code can still be problematic. To address this problem, I have created Artistic Style - a series of filters, written in C++, that automatically reindent & reformat C/C++/Java source files. These can be used as standalone tool from a command line, or they can be incorporated as classes in another C++ program.