Xref: utzoo alt.sources.wanted:1072 comp.sources.wanted:15758 comp.software-eng:5061 Path: utzoo!utgpu!cs.utexas.edu!usc!rpi!bu.edu!wang!comm.wang.com!lws From: lws@comm.wang.com (Lyle Seaman) Newsgroups: alt.sources.wanted,comp.sources.wanted,comp.software-eng Subject: Re: WANTED: "C" code line counter program Message-ID: <1991Mar14.192419.1576@comm.wang.com> Date: 14 Mar 91 19:24:19 GMT References: <1991Mar6.214157.18633@ntpal.uucp> <1991Mar11.182848.26693@comm.wang.com> <2969@inews.intel.com> Organization: Wang Labs, Platform Comms. Lines: 46 bhoughto@pima.intel.com (Blair P. Houghton) writes: >In article <1991Mar11.182848.26693@comm.wang.com> lws@comm.wang.com (Lyle Seaman) writes: >>Counting semi-colons is a pretty good approach, as that counts C >>statements. Lines is kind of less meaningful. Counting '{' is >>an interesting one, too. >{{{{{{{{printf("Oh, if I were a rich man... ;;;;;;;;;;;;;;;;;;;;;;;\n");}}}}}}}} Yeah, but that could just as easily be written: { { { { { { { { printf ( "Oh, if I were a rich man... ;;;;;;;;;;;;;;;;;;;;;;;\n" ) ; } } } } } } } } So either simple approach is susceptible to intentional obfuscation (but then, most such schemes are). No one claimed that counting semis and curlies was foolproof. You've demonstrated that it isn't. On the other hand, seasoned coders don't usually use ; and } to such excess. (Yes, there are *occasional* duplicates). However, they do usually include quite a few redundant newlines. Comments, preprocessor directives and white space are very common, and apparently the original poster didn't wish to count them. I stand by my suggestion. -- Lyle 508 967 2322 "We have had television problems directly lws@capybara.comm.wang.com attributable to something not understandable" Wang Labs, Lowell, MA, USA - unnamed believer in poltergeists