Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

c++ DEBUG?

  • 30-07-2009 09: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