Do you know a simple script to count NLOCs (netto lines of code). The script should count lines of C Code. It should not count empty lines or lines with just braces. But it doesn't need to be overly exact either.
相关问题
- Sorting 3 numbers without branching [closed]
- Multiple sockets for clients to connect to
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
Not a script, but you can try this command-line open source tool: NLOC
SLOCCOunt is not a simple script and does much more than what you need. However, it is a powerful alternative to the already mentioned Ohcount and NLOC. :)
I usually just do this:
Works only if your empty lines are really empty (no spaces). Sufficient for me.
Check out DPack plugin for Visual Studio. It has a stats report for any solution/project.
Source monitor is freeware source analysis software. It is windows application but it also can be run with parameters from command line.
It can analyze C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) or HTML.
I would do that using awk & cpp (preprocessor) & wc . awk removes all braces and blanks, the preprocessor removes all comments and wc counts the lines:
If you want to have comments included: