Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

c++ DEBUG?

  • 30-07-2009 10:18AM
    #1
    Registered Users, Registered Users 2 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