3 ms·
Yes, it did. The problem has literally disappeared. I believe that I can teach more interesting ways to catch and prevent errors than that stuff. I find that #
by ziotom78 4y ago
Yes, it did. The problem has literally disappeared.
I believe that I can teach more interesting ways to catch and prevent errors than that stuff. I find that #ifdef/#define errors are boring and not interesting. The #ifdef/#define errors are due to the archaic way to literally include C/C++ files one into another. By following your reasoning, one would «spoil» their own students and making them «idiots» just by using a language with a proper module system (Rust, Python, Pascal, Ada, Nim…).
Moreover, suggesting to use "#pragma once" means to teach them that you can use the features of the language at your advantage. It is silly to use X if it is error prone when there is Y that is simpler and prevents you from doing that kind of error. I am teaching them that it is worth to dig in the specification of your language and check for possible alternatives of doing X.
I'll give you a hint. Please should stop teaching your students how to write Makefiles just because you want to let them know that a tab at the beginning of a line is different than eight spaces, seriously. Make them learn CMake and use the time in your class to teach more useful stuff about dependencies, feature discoverability, etc. Your students will be eternally grateful.
- pif 4y agoI'm not advocating for keeping pragma once a secret: just let them use the historical way once, fall into the beginner error, and let them notice how dangerous copy/paste can be.