How do you flag code so that you can come back later and work on it?

前端 未结 23 2330
后悔当初
后悔当初 2020-12-24 11:46

In C# I use the #warning and #error directives,

#warning This is dirty code...
#error Fix this before everything explodes!
<         


        
23条回答
  •  心在旅途
    2020-12-24 12:18

    An approach that I've really liked is "Hack Bombing", as demonstrated by Oren Eini here.

    try
    {
       //do stuff
       return true;
    }
    catch // no idea how to prevent an exception here at the moment, this make it work for now...
    {
      if (DateTime.Today > new DateTime(2007, 2, 7))
        throw new InvalidOperationException("fix me already!! no catching exceptions like this!");
      return false;
    }
    

提交回复
热议问题