13.01.2015 Views

Pensar en C++ (Volumen 1) - Grupo ARCO

Pensar en C++ (Volumen 1) - Grupo ARCO

Pensar en C++ (Volumen 1) - Grupo ARCO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

✐<br />

✐<br />

✐<br />

“Volum<strong>en</strong>1” — 2012/1/12 — 13:52 — page 125 — #163<br />

✐<br />

3.9. Consejos para depuración<br />

compilar sólo para insertar código de depuración.<br />

Para activar y desactivar código de depuración dinámicam<strong>en</strong>te cree banderas<br />

booleanas.<br />

//: C03:DynamicDebugFlags.cpp<br />

#include <br />

#include <br />

using namespace std;<br />

// Debug flags ar<strong>en</strong>’t necessarily global:<br />

bool debug = false;<br />

int main(int argc, char* argv[]) {<br />

for(int i = 0; i < argc; i++)<br />

if(string(argv[i]) == "--debug=on")<br />

debug = true;<br />

bool go = true;<br />

while(go) {<br />

if(debug) {<br />

// Debugging code here<br />

cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!