Skip to content

Commit

Permalink
Update ex6_47.cpp
Browse files Browse the repository at this point in the history
You only want to print debugging information when debugging is NOT disabled (in other words, when NDEBUG is not defined; NDEBUG stands for No Debugging).  The original version was doing the opposite (printing vector size when debugging was disabled).
  • Loading branch information
Eternal21 authored Dec 26, 2017
1 parent fd22e26 commit 4dfa16c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ch06/ex6_47.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
//
// Created by pezy on 14/10/30.
//
// To turn off debugging, uncomment the following line, or compile the program with '-D NDEBUG' switch
//#define NDEBUG

#include <iostream>
#include <vector>
using std::vector; using std::cout; using std::endl;

#define NDEBUG

void printVec(vector<int> &vec)
{
#ifdef NDEBUG
#ifndef NDEBUG
cout << "vector size: " << vec.size() << endl;
#endif
if (!vec.empty())
Expand Down

0 comments on commit 4dfa16c

Please sign in to comment.