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...
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 visi.com my HONDA is a barbequed OYSTER! Yum!
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
by Chuck F ( snipped-for-privacy@yahoo.com). This tool strips out comments.
thanks Enrico
[...] [...]
Ah ha! I think I figured it out. This is simply your client's test of your regexp ability! :)
CBFalconer wrote: [...]
.. which in turn can be a major clue to understanding the code itself, since typical errors are a major input for digging into somebody else's way of thinking. Sometimes you need that such a model of their mind to decipher the code coming from it. Which proves one of the wisdoms I've gathered so far: it never pays to throw away information.
OTOH, such code _may_ yet better be thrown away right along with the comments, and rewritten from scratch, if deadlines permit.
I am, of course, in the former class (being German), and do hope to be in the second, i.e. after resolving the double negation: the reasonably well educated. ;-) But every now and then, one of those "false friends" still gets me. Thanks for pointing it out --- will try to remember not to do that any more.
-- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
CBFalconer wrote: [...]
.. which in turn can be a major clue to understanding the code itself, since typical errors are a major input for digging into somebody else's way of thinking. Sometimes you need such a model of their mind to decipher the code coming from it. Which proves one of the wisdoms I've gathered so far: it never pays to throw away information.
OTOH, such code _may_ yet better be thrown away right along with the comments, and rewritten from scratch, if deadlines permit.
I am, of course, in the former class (being German), and do hope to be in the second, i.e. after resolving the double negation: the reasonably well educated. ;-) But every now and then, one of those "false friends" still gets me. Thanks for pointing it out --- will try to remember not to do that any more.
-- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
Or those who were sloppy in editing their message :-) But my spelling is better'n yours, yar har yar har :-) (sentence, educate).
-- Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net) Available for consulting/temporary embedded and systems. USE worldnet address!
LOL. It was first thing in the morning, and I was somewhat irritated at the tone of the person to whom I was responding ;-)
-- Trevor Barton
message
and
of
the
I don't think the OP was aware of this.
Regards Sergio Masci
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
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
Hi Chuck,
I downloaded and compiled your uncomnt.zip: it works! Thanks. I made some minor changes in order to read files from the disk and not from the standard input.
ciao Enrico
-- *********************************************************** * Enrico Migliore - Co-founder and Senior Software Engineer * * FATTI srl - GPRS - GSM - OSGi software * Via Donatello 48 - 200200 - Solaro - Milano - Italy *
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
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 (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
In most cases, well-chosen formal parameter names should suffice, though a comment about what the return value means is often good.
-- Grant Edwards grante Yow! I'm rated PG-34!! at visi.com
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
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
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
Not needed; that capability was designed into the language.
John
Sometimes the parameter names are sufficient information, however often there are preconditions that should be commented [ the called function is expecting a certain level of initialisation, or if you want the function to do xxx, make sure you set yyy in parameter zzz]. Documenting ownership of dynamically allocated entities is a Good Thing too.
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
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.