Tomato Man said
Quote:> Its that season again - the managers are asking for counts of lines
>of code - not counting comments, or else I'd just pipe it all thru
>'wc -l'. Yeah, its a meaningless number, but, well, I do have to
>produce some kind of number.
It's worse than meaningless! Many companies have been burnt by such
dumb ideas - IBM among them - and if managers aren't aware of that
they aren't managing very well! (Of course, they may just figure
that the company can afford to throw money at IT without it
contributing anything useful back :-) )
Quote:> Programs to do this have been done about a million times - I'm looking
>for one. It has to be public domain, and it has to do both old c and c++.
>Any ideas on a product name I can search for ?
You probably already have it. Run the source through "cc -E". This
preprocesses the source, stripping comments, expanding headers and
adding "#line" directives (which allow the main compiler to generate
the correct debug references). Presumably you aren't going to be
allowed to count standard headers all over the place so you need
to run this output through a simple filter that discards lines if
the last "#line" directive named a .h file and counts, or outputs,
them if it named a .c file. It should only be half a dozen lines
of shell script :-).
Mike
--
.----------------------------------------------------------------------.
| Roan Technology Ltd. | |
| 54A Peach Street, Wokingham | Telephone: +44 118 989 0403 |