C source code formatter: looking for a good one - Page 3

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: C source code formatter: looking for a good one

Quoted text here. Click to load it

That's right, but - every tool needs expamples and practice to master. The
obfuscation is brought to grandmaster level at the IOCCC contests.

Tauno Voipio
tauno voipio @ iki fi




Re: C source code formatter: looking for a good one
Quoted text here. Click to load it

Obviously, or you wouldn't be able to do it! I interpret your comment as
meaning that C gives people rope to hang themselves with; that the
incapability of using the language properly is built into some programmers.

--
Peter Bushell
www.software-integrity.com




Re: C source code formatter: looking for a good one

Quoted text here. Click to load it

Hire an intern ;-)

Jamie



Re: C source code formatter: looking for a good one
Quoted text here. Click to load it

Stripping out comments from source code is usually a REALLY BAD idea.

Besides, usually the problem is getting the programmers to put the comments IN.

(Hey, it usually isn't the programmer's fault.  He KNOWS what that code does and
how it does it, and USUALLY, if the guy reading the code doesn't understand it
well enough WITHOUT comments, comments WILL NOT help him and he should NOT be
trying to modify it.)



Re: C source code formatter: looking for a good one



Quoted text here. Click to load it
and
Quoted text here. Click to load it

Dear John,

 I have to produce two versions of the code: one is commented and the other
 is clean. The one without comments will be compiled and linked to produce
 the executable code.

 In my previous thread I said that MISRA rules state that production code
 should be free of comments: I'm wrong! I misinterpreted rule number 10.

 thanks
 Enrico


Re: C source code formatter: looking for a good one

Quoted text here. Click to load it
comments IN.
does and
understand it
NOT be
other

Why on earth?

This policy will guarantee that after some time the commented version and
the run version differ. You will have far more problems than advantages of
it.

Please understand that the comments add nothing to the machine code
produced, so I do not understand what is the stripped version for.

If you are forced to give the source code out and would not like, there are
better methods of obfuscating the source that bare stripping of the
comments. For examples, see <http://www.ioccc.org/ . I strongly advise
against obfuscating the code.

Tauno Voipio
tauno voipio @ iki fi



Re: C source code formatter: looking for a good one


<snip>

Quoted text here. Click to load it

As I understood this, the uncommented version would be generated from the
commented version and only the commented version would be maintained.
Otherwise why bother with a tool?

Quoted text here. Click to load it

Yes the comments add nothing to the executable. So perhaps at some stage it
would be really useful to see the code without the comments telling you what
you should be seeing. If the code looks crap without the comments then the
code needs to be revised. If the comments make no difference to the
understanding of the code then they are superfluous and just cluttering up
the source. This would surely be a good way of telling if the comments are
of a high enough nature to actually add value to the source.

I think that in the future I will insist on code reviews where uncommented
code is looked at in isolation to commented code.

Regards
Sergio Masci



Re: C source code formatter: looking for a good one
Quoted text here. Click to load it

If that's true, why bother stripping the comments out before
building? Stripping the comments out is the first thing the
pre-processor does anyway...

--
Grant Edwards                   grante             Yow!  .. the HIGHWAY is
                                  at               made out of LIME JELLO and
We've slightly trimmed the long signature. Click to see the full one.
Re: C source code formatter: looking for a good one

Quoted text here. Click to load it
message
and
of
the

I don't think the OP was aware of this.

Regards
Sergio Masci



Re: C source code formatter: looking for a good one



Quoted text here. Click to load it


Dear Tauno

 thanks for your answer. I don't need to obfuscate the code. My customer
 required me to produce two versions of the code: the first one with and
 the second without comments. I was looking for a tool to put in the middle
 of the toolchain that would strip out comments before building the targets.

 I compiled and tested under win32 the tool: uncmntc.zip

               http://cbfalconer.home.att.net/download /

 by Chuck F ( snipped-for-privacy@yahoo.com). This tool strips out comments.

 thanks
  Enrico


Re: C source code formatter: looking for a good one
On Mon, 08 Dec 2003 17:23:43 +0100, Enrico Migliore

[text deleted]

Quoted text here. Click to load it

Also it seems to me that you want a tool that strips out unused #ifdef
code. This code would have possibly more effect on the configured
deliverable than comments.

Ken.

+====================================+
I hate junk email. Please direct any
genuine email to: kenlee at hotpop.com

Re: C source code formatter: looking for a good one
Quoted text here. Click to load it
IN.
and
it
be

Enrico, please, please, tell me that this is one of this "You know this is
idiotic, and I know this is idiotic, but my management has given me my marching
orders, and said 'And if you can't or won't do it, we will fire you and hire
someone who can and will.'"  Please tell me that this is what is going on.

Because this is completely idiotic.

--John



Re: C source code formatter: looking for a good one
--snip-- (hopefully preserving correct attribution (;-) --
Quoted text here. Click to load it

Programming environments _do_ exist where comments affect the code
size (interpreted BASIC, for example). Is there any chance that the
comment-removal reuirement was originally formulated with such an
environment in mind?

(...he said, desperately trying to make _some_ sense out of it (;-)).


Frank McKenney, McKenney Associates
Richmond, Virginia / (804) 320-4887
Munged E-mail: frank uscore mckenney ayut minds pring dawt com (y'all)

Re: C source code formatter: looking for a good one
On Mon, 8 Dec 2003 02:44:56 -0600, "John R. Strohm"

Quoted text here. Click to load it

Whether idiotic or not, in the "good 'ol days" it was common practice
for software houses to distribute uncommented source code to their
clients --- I can remember using an RTOS called MTOS which was sold by
Industrial Programming Inc. (IPI). IPI distributed uncommented source
code with their MTOS.

Also some clients require full source for archiving -- I guess they
don't trust you being around for the next 5 years. Now it may be that
some of the code is company proprietary and so a form of protection is
to use obscurity by removing all comments. I mean it's bad enough
looking at sphagetti code with comments let alone without comments.

Ken.

+====================================+
I hate junk email. Please direct any
genuine email to: kenlee at hotpop.com

Re: C source code formatter: looking for a good one

Quoted text here. Click to load it

I wrote a comment stripper back in the "good ol' days"- a customer had
screwed me to the floor, he wanted full source code, he got full,
compilable source code. My little program stripped out all comments, and
changed the names of variables to vxxxxxxx (xxxxxxx was a random number)
and functions to fxxxxxxx. Not very professional or clever, but
satisfying at the time. But that was long ago, and beside, the wench is
dead.

Paul Burke


Re: C source code formatter: looking for a good one

Quoted text here. Click to load it


Paul, I can see that you're not a person mess with  ;-)

The sad thing is that I sometimes still see code like that ---- but it
wasn't done maliciously.

Ken.

+====================================+
I hate junk email. Please direct any
genuine email to: kenlee at hotpop.com

Re: C source code formatter: looking for a good one

Quoted text here. Click to load it

I've done the same sort of thing with customers who demanded full source
"after the fact" i.e. not specified in the original contract. Reading your
post brought back fond memories of something I planned to do but never got
around to - writing a comment stripper that replaced valid comments with
randomly - generated, important - sounding phony ones ala "// Disable
watchdog supervisor for voltage interlock override" or "//Kernel hot patch
DO NOT RELOCATE!!! (see app note DC2300A)"

Could be pretty good fun for troublesome clients who are obviously trying
to lift your code ;)

Bob Stephens

Re: C source code formatter: looking for a good one

Quoted text here. Click to load it

That's one thing.  Clients *demanding* to get an uncommented copy of
the code, which the OP said is the case for him, is an entirely
different thing.  It's a strong sign that the client is way out of
their mind.  With clients like that, what would you need competition
for?

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: C source code formatter: looking for a good one
On 9 Dec 2003 15:12:55 GMT, Hans-Bernhard Broeker

Quoted text here. Click to load it

Yes, you're correct -- I've traced back the posts from the OP & it's
the client who wants the uncommented code.

As removing comments is a totally brain-dead activity, I can only
guess that the client themselves are a contractor and are trying to
remove all associations of the original authors of the code.

Ken.

+====================================+
I hate junk email. Please direct any
genuine email to: kenlee at hotpop.com

Re: C source code formatter: looking for a good one


Quoted text here. Click to load it
[...]
Quoted text here. Click to load it
[...]

Ah ha! I think I figured it out. This is simply your client's test of your
regexp ability! :)


Site Timeline