3 ms·
This reminds me of an interesting event that occurred in my C++ class. During one of the assignments I looked at a peers code. I became convinced that the code
by JoshCole 16y ago
This reminds me of an interesting event that occurred in my C++ class. During one of the assignments I looked at a peers code. I became convinced that the code was wrong. His code looked a little like this:
bool operator<(.., ..)
{
return operator<(.., ..);
}
He ran the code and it worked. I was confused.
Another student saw the teacher pass him and copied his implementation. His code didn't work. It gave the stack overflow error that I was expecting.
It turned out that the reason the guy had his code work in the first place was because it was never included in the program. He had put the code in his C++ file, but forgot to include it in his header. When the program compiled, it never knew his code existed.
- jayp08 16y agoI was teaching one of my good friend C way back in undergrad(1999). After explaining him about loops among other stuff...i asked him to print something in loop. And this is what he wrote For(i=1 to 10) {then print i; } Today my friend is working as a techie ....senior mgr at his new company!
- eru 16y agoSeems like you need to improve your teaching abilities?
- eru 16y agoIn gcc this would not give a stack overflow error.