Thread: order of execution of tokens in a c++ source code

  1. #1
    Registered User
    Join Date
    Oct 2008

    Unhappy order of execution of tokens in a c++ source code

    Please give me guidelines on how to go about writing a program which prints the order of execution of tokens in a c++ source code.
    The c++ source code file will be inputed by the user, the program has to print in which order the statements will be executed..

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    There will be executed sequentially. What more do you want?

  3. #3
    Registered User
    Join Date
    Apr 2006
    The order of execution is usually undefined, except as constrained by the order of operations and sequence points.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Tokens can't be executed; they're just tokens. Order of operations in a statement is not completely defined, as noted above. "Order of operations" for statements is normally top to bottom -- gotos would be easy to figure out, but for loops will be harder, and it may be impossible to figure out without running the program how many times a while loop (or some for loops, for that matter) will run.

    In other words, we have no idea what you're actually trying to do.

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    If it were possible to solve that for the general case then it would probably be possible to solve the halting problem too.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Documenting Source Code
    By jverkoey in forum A Brief History of
    Replies: 14
    Last Post: 01-04-2008, 12:18 PM
  2. How do you order your game code?
    By Queatrix in forum A Brief History of
    Replies: 15
    Last Post: 02-05-2006, 06:26 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
    Replies: 13
    Last Post: 05-19-2003, 03:50 PM
  5. C source code for int25 or code help
    By Unregistered in forum C Programming
    Replies: 0
    Last Post: 09-26-2001, 02:04 AM