Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Low level file functions -counting lines of code in prop
Message
From
15/05/1998 15:22:31
 
 
To
15/05/1998 14:37:17
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00099818
Message ID:
00099836
Views:
16
Sheena,

If this is for some "productivity" study (I see "GOVERNMENT" in your address!) then keep in mind that COMMENTARY *IS* CODE. More to the point, code ain't worth much without reasonable commentary! Period. End of song!

I should think that it is *NOT* likely that there is any "rule of thumb" regarding proportion of executable code versus commentary - depends on the complexity of what's at hand. But I could hazard that *ANY* program where commentary is less than 10% of all coded lines is a poorly coded program. While I personally hate typing, I hate trying to figure out what's going on reading strictly code even more, so I use much more than 10% myself (many lines have commentary on same line as code - how do you plan to count that???)
Besides, commentary *with* code gives me a chance to find bugs by finding discrepancies between what is in comments and what is coded. With code only, the *intent* cannot be learned. Comments usually tell intent and code usually does the intention.

Cheers,
Jim N

>Hello:
>I'm writing a program to count the lines of code in my programs.
>I need to be able the count the lines of code without including the comments and blank spaces. Any ideas on how to do this? THis is the code that I'm using that returns the total number of lines including comments.
>gnfilehandle = fopen("mainlib.prg")
>nsize = fseek(gnfilehandle,0,2)
>if nsize <= 0
>wait window "this file is empty!" nowait
>else
>=fseek(gnfilehandle, 0)
>lctext = fread(gnfilehandle, nsize)
>lnlines = occurs(chr(13), lctext)
>? lnlines
>endif
>
>This works and returns total number of lines. Any suggestions would be greatly appreciated.
Previous
Reply
Map
View

Click here to load this message in the networking platform