Does anyone know of a source code analyzer?

This is a discussion on Does anyone know of a source code analyzer? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; More specifically, what I am looking for is a program that will read through my source code file and find ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313

    Does anyone know of a source code analyzer?

    More specifically, what I am looking for is a program that will read through my source code file and find any unused variables, unmatched 'new's, and unoptimized loops.

    Thank you.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,546
    For which OS/Compiler?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by Salem
    For which OS/Compiler?
    There should be a button that just submits that reply


    Lithorien: your compiler is probably capable of many of those things if you turn the right flags on.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >what I am looking for is a program that will read through my
    >source code file and find any unused variables,
    >unmatched 'new's, and unoptimized loops.
    Post your program here.
    My best code is written with the delete key.

  5. #5
    Resident nerd elnerdo's Avatar
    Join Date
    Apr 2005
    Location
    Northern NJ
    Posts
    51
    That's a good idea for a programming challenge...

    Make a program analyzer.
    nerds unite!

    I'm using windows XP.
    I'm using dev-C++ by bloodshed.

  6. #6
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    More specifically, what I am looking for is a program that will read through my source code file and find any unused variables
    You'll probably have to turn on optimization to catch this type of stuff. Also, can you explain what you mean by unmatched 'new'? There a memory checkers that can find memory leaks.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,546
    > unused variables,
    lint - http://www.gimpel.com
    splint - http://www.splint.org
    source navigator - http://sourcenav.sourceforge.net/

    > unmatched 'new's,
    Any leak detector, say
    Valgrind
    Electric fence
    bounds checker

    > and unoptimized loops.
    Use a profiler or test coverage
    gprof and gcov, available with gcc.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by Salem
    For which OS/Compiler?
    Sorry, Salem.

    Windows 2003 Small Business Server, and the compiler's in my sig (Visual C++ 2003).

  9. #9
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by Perspective
    Lithorien: your compiler is probably capable of many of those things if you turn the right flags on.
    I've looked through the flag list of my compiler, and it doesn't appear to be able to show me those two specific things.

    Thanks for the idea though.

  10. #10
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by Prelude
    Post your program here.
    If you really want me to..

    Editor.cpp

  11. #11
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by Salem
    > unused variables,
    lint - http://www.gimpel.com
    splint - http://www.splint.org
    source navigator - http://sourcenav.sourceforge.net/

    > unmatched 'new's,
    Any leak detector, say
    Valgrind
    Electric fence
    bounds checker

    > and unoptimized loops.
    Use a profiler or test coverage
    gprof and gcov, available with gcc.
    Thank you, thank you, thank you!

  12. #12
    Registered User
    Join Date
    Dec 2002
    Posts
    56
    4 replies in a row in 7 minutes! No way!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do you call another source code file?
    By nifear4 in forum C Programming
    Replies: 2
    Last Post: 10-28-2008, 12:16 PM
  2. 'Type' Error on Build of Officially Released Source Code
    By Jedi_Mediator in forum C++ Programming
    Replies: 5
    Last Post: 07-07-2008, 05:28 PM
  3. DxEngine source code
    By Sang-drax in forum Game Programming
    Replies: 5
    Last Post: 06-26-2003, 05:50 PM
  4. Lines from Unix's source code have been copied into the heart of Linux????
    By zahid in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 05-19-2003, 03:50 PM
  5. Source Code Beautifier
    By Hammer in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 05-05-2002, 09:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21