error finder

This is a discussion on error finder within the C++ Programming forums, part of the General Programming Boards category; ive had this idea of a program that reads your code and tries every option that exist in the code ...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    196

    error finder

    ive had this idea of a program that reads your code and tries every option that exist in the code ,ie if you code contains to if statemants it checks them both and then there if statements and what have you but although i doubt im advanced enouph to go on about this has anyone ever made one of these,how would one go about making such a program

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,069
    Hmmm... It looks like your random word generator works good.
    Sent from my iPadŽ

  3. #3
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Are you talking about something that generates code or checks whether it's syntactically correct. You need to express more cohesive thoughts.

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  4. #4
    Registered User
    Join Date
    Sep 2005
    Posts
    196
    random word generator?
    oookk...
    (someones a little old)

    moving right along


    what i mean is like your create a function in your program like ai.what it does is tries every choice and every action available througout the case to make sure nothings wrong.

    "why not do this yourself" you may ask.


    well for a large game that could be thousands of interations... so creating this would really speed up debugging time.

    on a side note
    sly if your gonna post have something usefull to say,

  5. #5
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Why would it need to try 'every single choice and every action' to see if somethings wrong? By debugging, do you mean the running application or compiler errors. A compiler can check errors, and report them to you. If you wanted to make a program to generate a logical solution to shut up compiler errors, there's really a limited set of syntactically logical things that can go in any expression.

    But there's so so many ways an instruction that just fits the mold of some expression can be evaluated in an unintended way. You can't just generate something so that it works. Better to have millions of monkeys banging on keyboards till you get what you want.

    Thousands of iterations? Iterations of your eyes looking at code? What? Look, at this point in time, you can not take the programmer out of programming. You still need to tell the computer what you want, it's not psychic. We're also not psychic. You might want to work on higher level communication with humans before you need to translate your thought process into a series of instructions. For a computer.

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,069
    Beta testers are significantly more efficient for finding bugs, it costs the developers less time and money because they don't have to purchase the test systems. Just create an error reporting system within your program, distribute it to a bunch of testers, let them use it on their own set-ups and collect the bugs.

    Also, when you write posts that are as incoherent as your first, you're lucky if you get any replies, at all.
    Sent from my iPadŽ

  7. #7
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    Interesting word choices aside (maybe english isn't the OP's native language?), I think what the OP is asking for is a system to automatically examine code and generate sets of conditions to guarantee that every possible branch of execution takes place. E.g. if the code was simple:

    Code:
    if (condition1){
    ...
    }
    else {
    ...
    }
    ...
    if (condition2){
    ...
    }
    else {
    ...
    }
    It would need to try (condition1, condition2) = (false,false), (false, true), (true, false), (true, true). So the code would be executed 4 times to get every combination branch of code.

    Of course, on a sophisticated program it could take billions of sets of conditions to exhaustively test like this. Possibly a virtually infinite set once you start accepting user input. And even then it's not completely exhaustive because to truly exhaust every single possible execution of your code, you'd also need to have every combination of all possible values for each variable, as it's often a variable having an incorrect value that causes code to crash.
    Last edited by Cat; 09-01-2006 at 03:29 AM.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Compilers already do this to some extent to trace value propagation, assign registers, eliminate dead code, find aliases and uninitialized reads, and much other optimization stuff.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

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