Anzahl von Variablen ermitteln
-
Hallo,
gibt es eine Möglichkeit bei einem Projekt die Anzahl der benötigten Variablen, am besten auch noch aufgelistet in bol, int, ... usw. zu ermitteln ohne mit der Strichliste den ganzen Code zu durchforsten?
Danke
Pille
-
Nur aus Neugierde: Wozu?
-junix
-
bin mom. im Praxissemester in nem Betrieb und die wollen eine Analyse über ihre Programm erstellt haben. Jetzt sitz ich vor nem Berg von alten Projekten und soll solche Dinge eben tun.
Auserdem z.B. Anzahl der Verschachtelung und tiefe etc., Anzahl der Kommentare und das Verhältniss zum gesamten Code
-
Äh und der tiefere Sinn?
Schau mal ob du den Compiler so konfigurieren kannst, dass er dir ein memory-Mapping auswirft... allerdings wage ich das zu bezweifeln... Geht normalerweise nur wirklich gut bei Embedded Compilern...
-junix
-
1. endweder du schreibst ein script ( perl z.b. ) das alle .cpp und .h dateien in einem ordner ( + unterordner ) durchforstet und zählt
z.b. ein
int a ( schlüsselwort int dann 1 oder mehrere " " + variablennamen
2. per hand durchgehen ( macht keinen spass
)
3. maybe im debugger? aber da siehst du imho die im akt block?! oder doch alle?
4. oder du benutzt gleich das BESTE um code analyse zu betreiben
Doxygen is a documentation system for C++, C, Java, Objective-C, IDL (Corba and Microsoft flavors) and to some extent PHP, C# and D.
It can help you in three ways:
It can generate an on-line documentation browser (in HTML) and/or an off-line reference manual (in ) from a set of documented source files. There is also support for generating output in RTF (MS-Word), PostScript, hyperlinked PDF, compressed HTML, and Unix man pages. The documentation is extracted directly from the sources, which makes it much easier to keep the documentation consistent with the source code.
You can configure doxygen to extract the code structure from undocumented source files. This is very useful to quickly find your way in large source distributions. You can also visualize the relations between the various elements by means of include dependency graphs, inheritance diagrams, and collaboration diagrams, which are all generated automatically.
You can even `abuse' doxygen for creating normal documentation (as I did for this manual).
Doxygen is developed under Linux and Mac OS X, but is set-up to be highly portable. As a result, it runs on most other Unix flavors as well. Furthermore, executables for Windows are available.
-
Es gibt sehr viele fertige Programme zur Codeanalyse, einfach mal google anwerfen (z.B. http://smartbearsoftware.com/section-products.php ).
Wenn du was eigenes schreiben willst/musst, dann nimm doch einfach einen fertigen Parser mit passendem Ausgabeformat (z.B. http://public.kitware.com/GCC_XML/HTML/Index.html ). Dann kannst du dir in ein Paar Stunden ein Programm drumherum schreiben, das die benötigten Infos raussucht.