C source code formatter: looking for a good one

C source code formatter: looking for a good one

Post by Enrico Mig » Sat, 06 Dec 2003 15:18:43


Hi folls,

I'm looking for a good C source code formatter that
eventually be able to strip out comments from the
source.

thanks
Enrico
 
 
 

C source code formatter: looking for a good one

Post by bastian4 » Sat, 06 Dec 2003 15:32:54

>

indent + a little perl-script does this for me.

---
42Bastian
Do not email to XXXX@XXXXX.COM , it's a spam-only account :-)
Use <same-name>@epost.de instead !

 
 
 

C source code formatter: looking for a good one

Post by David Brow » Sat, 06 Dec 2003 16:23:16


Are you thinking of some sort of automatic documentation tool? If so, have
a look at http://www.yqcomputer.com/
 
 
 

C source code formatter: looking for a good one

Post by Emmanuel H » Sat, 06 Dec 2003 17:51:42

Hi Enrico,

In the Win32 world, I use to write my source using
a small freeware called "JFE".

In this editor, there is an automatic indent function
for C/C++ (edit/operations/align C syntax).
IMHO, this is a really good software you should try.
(thanks to Jens Altmann !)

Regards
Emmanuel.
 
 
 

C source code formatter: looking for a good one

Post by Sergio Mas » Sat, 06 Dec 2003 18:18:42


The C preprocessor strips comments out of your source code for you already.
Look for the switch that enables preprocessor output and set it.

Regards
Sergio Masci

http://www.yqcomputer.com/
 
 
 

C source code formatter: looking for a good one

Post by Enrico Mig » Sat, 06 Dec 2003 19:11:03


thanks Sergio, I did it: the preprocessor does strip out all comments
but it adds also all header files.

Enrico
 
 
 

C source code formatter: looking for a good one

Post by CBFalcone » Sat, 06 Dec 2003 19:15:34


GNU indent will handle the formatting. To strip comments, see
uncmntc.zip, available in source form at:

< http://www.yqcomputer.com/ ;

which will not handle trigraphs, nor multi-char char constants
such as 'ab'. Strings are alright.

--
Chuck F ( XXXX@XXXXX.COM ) ( XXXX@XXXXX.COM )
Available for consulting/temporary embedded and systems.
< http://www.yqcomputer.com/ > USE worldnet address!
 
 
 

C source code formatter: looking for a good one

Post by Peter Bush » Sat, 06 Dec 2003 22:30:00


Why do you want to strip the comments out?
 
 
 

C source code formatter: looking for a good one

Post by Ira Baxte » Sat, 06 Dec 2003 23:22:45


See http://www.yqcomputer.com/
Our C formatter can do both of these tasks trivially.

I'd guess from your interest in stripping comments
that you might be interested in obfuscating the source.
The same page will lead to a link to C obfuscating tools.


--
Ira D. Baxter, Ph.D., CTO 512-250-1018
Semantic Designs, Inc. www.semdesigns.com




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.yqcomputer.com/ The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
 
 
 

C source code formatter: looking for a good one

Post by Bryan Hack » Sun, 07 Dec 2003 00:11:28


[...]

My question. I used to say that incorrect comments (stale or initially
wrong) are much worse than no comment at all. Maybe he wants to strip them
out and start over.
 
 
 

C source code formatter: looking for a good one

Post by Grant Edwa » Sun, 07 Dec 2003 00:33:24


Amen. I find that more often than not when given some old code
to fix/update I'm better off just deleting the comments so that
I don't get misled.

Somebody ought to write a paper entitled "Comments Considered
Harmful". Maybe somebody already has...

--
Grant Edwards grante Yow! But they went to MARS
at around 1953!!
visi.com
 
 
 

C source code formatter: looking for a good one

Post by Hans-Bernh » Sun, 07 Dec 2003 00:43:23


Even so, I don't see how deleting them *all* in a single sweep, before
rewriting them from scratch is going to do you much good. Just cut
out the old contents as you replace them with new ones, making sure
you leave a fingerprint to distinguish rewritten comments from legacy
ones if you don't do it strictly in linear order down the source...

Even a collection of mostly misguided comment may still contain the
occasional pearl you'll need to understand the program good enough to
write your own ones... Classifying them all as wrong without
personally reading every last one of them (by letting a machine kill
them away) is arguably just as silly as taking them all to be written
gospel.

--
Hans-Bernhard Broeker ( XXXX@XXXXX.COM )
Even if all the snow were burnt, ashes would remain.
 
 
 

C source code formatter: looking for a good one

Post by Enrico Mig » Sun, 07 Dec 2003 00:46:28


Hi Bryan,

there are two reasons:

1. the MISRA industry guidelines say that the production code should
be free of any comment.

2. My customer wants two versions of the code I'm writing for him:
the commented and a "clean" one.


Enrico
 
 
 

C source code formatter: looking for a good one

Post by Bryan Hack » Sun, 07 Dec 2003 01:00:35


I've never looked into MISRA, and probably never will, but this is very
strange. Who came up with that and why?

My code is free of comments by the time the compiler gets it.
 
 
 

C source code formatter: looking for a good one

Post by Grant Edwa » Sun, 07 Dec 2003 01:00:38


Agreed. I didn't mean to imply that deleting them all
completely before starting was a good idea.


Mostly I deleting the comment and replace the _code_ with code
that is readable. The only comments I find generally useful
are a high-level description of what a function is supposed to
be used for. Occasionally a comment describing what a
particular obtuse block of code is intended to do can be
helpful, but the low-level comments I often find trying to
explain what's going on line-by-line are usually worse than
useless.

--
Grant Edwards grante Yow! I guess it was all a
at DREAM... or an episode of
visi.com HAWAII FIVE-O...