Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

c++ DEBUG?

Options
  • 30-07-2009 10:18am
    #1
    Registered Users Posts: 329 ✭✭


    #include <iostream>
    #include<cdtg>
    using namespace std;
    const int N = 10;
    int main()
    {
    array<int,N> data;
    setRandom(data);
    DEBUG(data);
    int sum = 0;
    cout << data << endl;
    for (int i=0; i<N; i++) {
    sum += data;
    }
    cout << "Sum = " << sum << endl;
    return 0;
    }

    Hey just wondering what the purpose of the highlighted code is? It runs the same without it through a compiler, missed a few classes on debugging and would appreciate a helping hand...

    Cheers


Comments

  • Closed Accounts Posts: 7,794 ✭✭✭JC 2K3


    It's a macro. You'll need to find where it's #defined and look at what it does.

    It probably checks if a debug flag is set and then prints the parameter to cerr. i.e. if you want to debug the program and print out information on variable contents etc., you'd run the program with --debug or something


Advertisement