Here is a trick I learned many many years ago and it remains one of the best tools in my debugging toolbox for all programming languages. This example just happens to be in C++.
#include <iostream>
int main(int argc, const char * argv[]) {
std::cout << "Hello\n";
//*
std::cout << "Hello, World!\n";
/*/
std::cout << "A different Hello!\n";
//*/
return 0;
}
now remove the first slash in the front of the first comment and you get:
#include <iostream>
int main(int argc, const char * argv[]) {
std::cout << "Hello\n";
/*
std::cout << "Hello, World!\n";
/*/
std::cout << "A different Hello!\n";
//*/
return 0;
}
No comments:
Post a Comment