I just had this idea for something that I'd love to be able to use:
Let's say I have to fix a bug and I decide to write an ugly code line that fixes the immediate problem - but only because I promise myself that I will soon find the time to perform a proper refactoring.
I want to be able to somehow mark that code line as "Expired in" and add a date - so that if the code is compiled some time after that date there will be a compilation error/warning with a proper message.
Any suggestions? It must be possible to perform - maybe using some complicated #IF or some options in visual studio?
I'm using VS 2005 - mainly for C#.
Thanks!
[EDIT]: Wow - never expected this question to raise so much interest :)
Thank you all for your answers and for turning this into an interesting debate.
I know it's hard to justify using anything like this - and I probably won't use it - but sometimes, when you have to ship a version YESTERDAY and you find yourself compromising on a patchy fix instead - you want to force yourself to fix it in the near future.
I chose MartinStettner's suggestion as the answer because it met my needs - no error on runtime - only during compilation, no need to define new types just for this goal - and it's not limited to a scope of an entire method. Cheers!
question from:
https://stackoverflow.com/questions/5222015/how-to-write-a-code-with-expiration-date 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…