how can I remove all the comments in my c program.

O

On Web

Chris Carter said:
Nowhere did the OP state that this is the reason. Someone else threw
that out. There may be a legitimate reason for this.

I was referring to the GPL comment dodge.

Still, stripping comments in a compiled language seems a bizarre idea to me,
apart from deliberately making it more difficullt for others to follow, or
to hide the origin of the code.

The OP has stated in another post that the intention (if I understand the
post correctly) is to neaten the code and to allow alignment of the program
lines.

Most companies would slap my wrists if I deliberately removed comments from
a source file and as for alignment, try and do it as you go along, or at
least try and not have huges source files so it's not too difficullt a
proposition.

Paul
 
A

ara.t.howard

Hello Friends,
I am also working in software company.
You ask know why are removing the comments in your c program.
For needness I want to remove all the comments and also I want to
align
all the program coding lines.

sorry, i meant

man indent

it'll do all that and more. on pretty much every *nix box.

a @ http://drawohara.com/
 
A

ara.t.howard

I was referring to the GPL comment dodge.

Still, stripping comments in a compiled language seems a bizarre
idea to me,
apart from deliberately making it more difficullt for others to
follow, or
to hide the origin of the code.

The OP has stated in another post that the intention (if I
understand the
post correctly) is to neaten the code and to allow alignment of the
program
lines.

Most companies would slap my wrists if I deliberately removed
comments from
a source file and as for alignment, try and do it as you go along,
or at
least try and not have huges source files so it's not too difficullt a
proposition.

people need to step back and realize that this is a religious issue
not really related to ruby itself.

i happen to think comments are a crutch in in any language. here is
an excerpt from the last program i wrote:



#! /dmsp/reference/bin/ruby

require 'time'
require 'ostruct'
require 'alib'
require 'lockfile'
require 'dmsp'
require 'nrtlib'
require 'stpjob'

Main {

synopsis "gen_night_file_from_dawn_dusk_orbit_pairs [options]+
descending_olspath [ascending_olspath]"

default "destination" => "/dmsp/nrt/data/incoming/
night_files_dawn_dusk"
default "window" => (42.minutes .. 62.minutes)

option "--link" , "-l" ,
"link files to operate on - default(copy)"

option "--destination=destination" , "-d" ,
"specify output destination - default(#{ default 'destination' })"

option "--clobber" , "-c" ,
"force output to be clobbered iff it exists - default(false)"

option "--window=window" , "-w" ,
"specify time window in which to look for ascending mate -
default(#{ default('window').to_a.join ',' }s)"

option "--turd" , "-t" ,
"leave your things lying around default(false)"

argument "descending_olspath"

optional_argument "ascending_olspath"


def main
setup

tmpdir do |tmp|
atomically_download_input
generate_night_files
atomically_upload_output
exit! 42 if turd?
end

exit 0
end

...
...
...


i do not think comment can add any clarity to code that's written
like this and, yes, you can do the same in C. that being said i'm
(literally) on crutches now and everyone needs them sometimes - they
are not evil - just crutches. compilers are crutches for not being
able to write assembly code quickly enough.

regards.

a @ http://drawohara.com/
 
O

On Web

ara.t.howard said:
On Sep 21, 2007, at 8:10 AM, On Web wrote: snip

people need to step back and realize that this is a religious issue not
really related to ruby itself.

Yes, it's nothing to do with ruby, religious issue? I don't think so.
i happen to think comments are a crutch in in any language. here is an
excerpt from the last program i wrote:
snip

i do not think comment can add any clarity to code that's written like
this and, yes, you can do the same in C. that being said i'm (literally)
on crutches now and everyone needs them sometimes - they are not evil -
just crutches. compilers are crutches for not being able to write
assembly code quickly enough.

Well, I don't think the HLL compiler/LLL assembler analogy is right or
elevant here.

I understand that well written code can really reduce the need for comments
and comments can sometimes get in the way of reading the flow of code. The
real judge of whether comments are useful is when someone else who hasn't
written the code has to read it. They may even be new to the problem domain
and programming so what seems obvious to those 'in the zone' might be a
complete mystery to someone else, so comments are helpful in those
circumstances. Then we consider the environment where the code is written.
You might be writing the code, but two years down the line, Sarah will be
trying to make sense of it. Sarah has been told to add some feature to the
code if it's not there already. She's been told it's probably there, but
feature 'x' didn't go live when it should have, so it may already have been
coded, or not. It may just need testing to make sure that feature works. Of
course, you've left the company and changed address and phone number. Worse
still, you quarrelled with your old project manager so aren't minded to
co-operate in helping Sarah know what state the code's in.

If nothing else comments can provide a way of tracing the history of code, a
way of identifying who did what and a way of annotation so that you know
that a particular section of code has been altered to suit a particular
change request or bugfix ("Sarah, we've changed the database and object
model, please alter any code that was introduced for change request 66.9 to
reflect the new changes. Please check with whoever made those changes if you
can.").

So, I agree comments should be kept to a minimum. I don't agree that they
are a crutch - they are important for the working dynamic in an environment
where programmers aren't just developing for themselves. If you were working
in my team, you would be including comments - like it or not.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top