By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,007 Members | 979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,007 IT Pros & Developers. It's quick & easy.

C/C++ code beautifier

P: n/a
Hi all!

Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?

Regards,

Diego
Jul 22 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
Diego Andres Alvarez Marin wrote:
Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?


Have you tried www.google.com?
Jul 22 '05 #2

P: n/a
On Tue, 16 Nov 2004 15:17:45 -0800, Diego Andres Alvarez Marin wrote:
Hi all!

Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?

Regards,

Diego


Assuming you mean C and/or C++, yes, there are many. This is not on-topic
here though, you should ask in comp.unix.programmer or a linux group. You
could alternatively learn how to use a search engine and find all the
information you seek in a few seconds.

Rob Gamble
Jul 22 '05 #3

P: n/a
Diego Andres Alvarez Marin wrote:


Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?

Artistic Style

http://astyle.sourceforge.net/

Jul 22 '05 #4

P: n/a
On Tue, 16 Nov 2004 15:21:38 -0800, E. Robert Tisdale wrote:
Diego Andres Alvarez Marin wrote:


Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?

Artistic Style

http://astyle.sourceforge.net/


To the OP: If you have any questions or comments about this program,
please feel free to email Tisdale directly as opposed to asking here.

Rob Gamble
Jul 22 '05 #5

P: n/a
Robert Gamble wrote:
Assuming you mean C and/or C++, yes, there are many.


Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?
Jul 22 '05 #6

P: n/a
In article <50**************************@posting.google.com >,
Steve Kobes <st*********@hotmail.com> wrote:
Robert Gamble wrote:
Assuming you mean C and/or C++, yes, there are many.


Out of curiosity, when would C/C++ ever mean anything *other* than "C
and/or C++"?


http://groups.google.com/gr*********...it.cornell.edu

Unfortunately the link seems to be dead.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca

Silly, yes. But have we shown that it is unhelpful?
--Daniel Fox in comp.lang.c
Jul 22 '05 #7

P: n/a
Quoth Diego Andres Alvarez Marin on or about 2004-11-16:
Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?


GNU Indent
http://directory.fsf.org/GNU/indent.html
http://gnuwin32.sourceforge.net/packages/indent.htm

HTH
-trent
Jul 22 '05 #8

P: n/a
Victor Bazarov <v.********@comAcast.net> wrote in message news:<L6*****************@newsread1.dllstx09.us.to .verio.net>...
Diego Andres Alvarez Marin wrote:
Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?


Have you tried www.google.com?


Believe me that I spend 15 minutes before asking here and I did not
find anything... maybe I did not put the right words...
Jul 22 '05 #9

P: n/a
di****************@lycos.co.uk (Diego Andres Alvarez Marin) writes:
Victor Bazarov <v.********@comAcast.net> wrote in message news:<L6*****************@newsread1.dllstx09.us.to .verio.net>...
Diego Andres Alvarez Marin wrote:
> Is there a linux tool that uses as input my ugly C/C++ code and
> outputs a pretty and nice formated source code?


Have you tried www.google.com?


Believe me that I spend 15 minutes before asking here and I did not
find anything... maybe I did not put the right words...


"c beautifier" hits lots of useful programs and links.
--
"I hope, some day, to learn to read.
It seems to be even harder than writing."
--Richard Heathfield
Jul 22 '05 #10

P: n/a
st*********@hotmail.com (Steve Kobes) wrote:
Robert Gamble wrote:
Assuming you mean C and/or C++, yes, there are many.


Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


All too often, when someone uses the term "C/C++", it appears that they
mean "C and C++-with-objects-ignored, which is exactly the same thing,
isn't it?". Of course, it isn't the same thing at all, and such people
tend to run into problems trying to compile C code with a C++ compiler,
or vice versa.

Richard
Jul 22 '05 #11

P: n/a
On Wed, 17 Nov 2004 00:07:23 -0800,
Ben Pfaff <bl*@cs.stanford.edu> wrote:

di****************@lycos.co.uk (Diego Andres Alvarez Marin) writes:
Victor Bazarov <v.********@comAcast.net> wrote in message news:<L6*****************@newsread1.dllstx09.us.to .verio.net>...
Diego Andres Alvarez Marin wrote:
> Is there a linux tool that uses as input my ugly C/C++ code and
> outputs a pretty and nice formated source code?

Have you tried www.google.com?


Believe me that I spend 15 minutes before asking here and I did not
find anything... maybe I did not put the right words...


"c beautifier" hits lots of useful programs and links.


Not to mention that normally linux comes with a butifier, as did most unix
systems for decades.

Villy
Jul 22 '05 #12

P: n/a
Diego Andres Alvarez Marin wrote:
Victor Bazarov wrote:
Diego Andres Alvarez Marin wrote:
Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?
Have you tried www.google.com?


Believe me that I spend 15 minutes before asking here
and I did not find anything...


You should have told us that in your original post.
Maybe I did not put the right words...


I used Google

http://www.google.com/

to search for

+"reformat C++"

and I found lots of stuff including:

http://www.vijayawadasite.com/home/c...al-issues.html

[30.2] Are there any pretty-printers that reformat C++ source code?

[snip]

In alphabetical order:

* Artistic Style is a reindenter and reformatter of C++, C and Java
source code. It is available from http://gene.md.huji.ac.il/~tald/astyle/
* C++2LaTeX is a LaTeX pretty printer. It is available from
http://mirriwinni.cse.rmit.edu.au/ft...TeX-4.0.tar.gz
* C-Clearly by V Communications, Inc. is a Windows program that
comes with standard formatting templates and also allows you to
customize your own. http://www.mixsoftware.com/product/ccl.htm
* GNU indent program may help. It's available at
http://www.arceneaux.com/indent.html. You can also find an "official"
GNU mirror site by looking at http://www.gnu.org/order/ftp.html or
perhaps the original GNU site, ftp://prep.ai.mit.edu/pub/gnu/ (e.g., if
the current version is 1.9.1 you could use
ftp://prep.ai.mit.edu/pub/gnu/indent-1.9.1.tar.gz).
* tgrind is a Unix based pretty printer. It usually comes with the
public distribution of TeX and LaTeX in the directory
"...tex82/contrib/van/tgrind". A more up-to-date version of tgrind by
Jerry Leichter can be found on: ftp://venus.ycc.yale.edu/pub in
[.TGRIND]. [Note: If anyone has an updated URL for tgrind, please let me
know (cl***@parashift.com).]

Finally, you might consider lgrind which is another C++ to LaTeX
translator (check for the closest mirror site of the ctan archive). The
following is a grind definition for C++ (but this one doesn't recognize
some new keywords such as bool or wchar_t, and it doesn't recognize a
file ending with .cpp as C++):

C++|c++|CC:\
:pb=\p\d?\(:cf:np=\)\d?;:bb={:be=}:\
:cb=/*:ce=*/:ab=//:ae=$:sb=":se=\e":lb=':\
:zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|% :\
:le=\e':tl:id=_~\::\
:kw=asm auto break case cdecl char continue default do double else\
enum extern far float for fortran goto huge if int interrupt long\
near pascal register return short signed sizeof static struct\
switch typedef union unsigned while void\
#define #else #endif #if #ifdef #ifndef #include #undef # define\
endif ifdef ifndef include undef defined #pragma\
class const delete friend inline new operator overload private\
protected public template this virtual:
Jul 22 '05 #13

P: n/a
On 16 Nov 2004 21:26:22 -0800, in comp.lang.c , st*********@hotmail.com
(Steve Kobes) wrote:
Robert Gamble wrote:
Assuming you mean C and/or C++, yes, there are many.


Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


Quite frequently, people that use "C/C++" have the idea that the two
languages are so similar that they're interchangable, or that C is a subset
of C++, or that C++ is a superset of C. None of these is true, hence the
mere sight of C/C++ tends to send shivers up the regular's spines.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 22 '05 #14

P: n/a
Steve Kobes wrote:
Robert Gamble wrote:
Assuming you mean C and/or C++, yes, there are many.

Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


C++ was designed by the same people at Bell Labs.
C++ was designed to replace C and not compete with it.
C++ *subsumes* C.
Most popular implementations compile both C or C++.
Jul 22 '05 #15

P: n/a
Steve Kobes wrote:
Robert Gamble wrote:
Assuming you mean C and/or C++, yes, there are many.

Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


Roman numerals mixed with C operators? 100/100++ = 100/101 ~= 0.99
Jul 22 '05 #16

P: n/a
In message <cn**********@nntp1.jpl.nasa.gov>, E. Robert Tisdale
<E.**************@jpl.nasa.gov> trolled

C++ was designed by the same people at Bell Labs.


bool same(std::string a, std::string b);

assert(same("Stroustrup", "Ritchie"));

Yeah, right.

--
Richard Herring
Jul 22 '05 #17

P: n/a
I always though that a C/C++ beautifier was ADA....

Runs off to find asbestos suit and a ticket off the planet :-)

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Jul 22 '05 #18

P: n/a
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message news:<cn**********@nntp1.jpl.nasa.gov>...
Diego Andres Alvarez Marin wrote:
Victor Bazarov wrote:
Diego Andres Alvarez Marin wrote:

Is there a linux tool that uses as input my ugly C/C++ code and
outputs a pretty and nice formated source code?

Have you tried www.google.com?


Believe me that I spend 15 minutes before asking here
and I did not find anything...


You should have told us that in your original post.
Maybe I did not put the right words...


I used Google

http://www.google.com/

to search for

+"reformat C++"

and I found lots of stuff including:

http://www.vijayawadasite.com/home/c...al-issues.html

[30.2] Are there any pretty-printers that reformat C++ source code?

[snip]

In alphabetical order:

* Artistic Style is a reindenter and reformatter of C++, C and Java
source code. It is available from http://gene.md.huji.ac.il/~tald/astyle/
* C++2LaTeX is a LaTeX pretty printer. It is available from
http://mirriwinni.cse.rmit.edu.au/ft...TeX-4.0.tar.gz
* C-Clearly by V Communications, Inc. is a Windows program that
comes with standard formatting templates and also allows you to
customize your own. http://www.mixsoftware.com/product/ccl.htm
* GNU indent program may help. It's available at
http://www.arceneaux.com/indent.html. You can also find an "official"
GNU mirror site by looking at http://www.gnu.org/order/ftp.html or
perhaps the original GNU site, ftp://prep.ai.mit.edu/pub/gnu/ (e.g., if
the current version is 1.9.1 you could use
ftp://prep.ai.mit.edu/pub/gnu/indent-1.9.1.tar.gz).
* tgrind is a Unix based pretty printer. It usually comes with the
public distribution of TeX and LaTeX in the directory
"...tex82/contrib/van/tgrind". A more up-to-date version of tgrind by
Jerry Leichter can be found on: ftp://venus.ycc.yale.edu/pub in
[.TGRIND]. [Note: If anyone has an updated URL for tgrind, please let me
know (cl***@parashift.com).]

Finally, you might consider lgrind which is another C++ to LaTeX
translator (check for the closest mirror site of the ctan archive). The
following is a grind definition for C++ (but this one doesn't recognize
some new keywords such as bool or wchar_t, and it doesn't recognize a
file ending with .cpp as C++):

C++|c++|CC:\
:pb=\p\d?\(:cf:np=\)\d?;:bb={:be=}:\
:cb=/*:ce=*/:ab=//:ae=$:sb=":se=\e":lb=':\
:zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|% :\
:le=\e':tl:id=_~\::\
:kw=asm auto break case cdecl char continue default do double else\
enum extern far float for fortran goto huge if int interrupt long\
near pascal register return short signed sizeof static struct\
switch typedef union unsigned while void\
#define #else #endif #if #ifdef #ifndef #include #undef # define\
endif ifdef ifndef include undef defined #pragma\
class const delete friend inline new operator overload private\
protected public template this virtual:


Check out a Windows program called Crystal FLOW for C/C++ from
http://www.sgvsarc.com/

In addition to an excellent code beautifier, it creates flowcharts
from C/C++ code. Has a complete code browser too.
Jul 22 '05 #19

P: n/a
Chris Hills <ch***@phaedsys.org> wrote in message news:<c2**************@phaedsys.demon.co.uk>...
I always though that a C/C++ beautifier was ADA....

Runs off to find asbestos suit and a ticket off the planet :-)

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

I found an excellent Windows program called Crystal FLOW for C/C++ from
http://www.sgvsarc.com/

In addition to a nice code beautifier, it creates the best flowcharts
from code I have seen. It has a complete code browser too.
Jul 22 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.