孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

/*
  Example4_17.cs illustrates the use of the
  #undef, #elif, and #else preprocessor directives
*/

#define DEBUG
#undef DEBUG
#define PRODUCTION

class Example4_17
{

  public static void Main()
  {

    int total = 0;
    int counter = 0;

    myLabel:
    counter++;
    total += counter;
    System.Console.WriteLine("counter = " + counter);
    if (counter < 5)
    {
#if DEBUG
      System.Console.WriteLine("goto myLabel");
#elif PRODUCTION
      System.Console.WriteLine("counter < 5");
#else
      System.Console.WriteLine("goto myLabel, counter < 5");
#endif
      goto myLabel;
    }

    System.Console.WriteLine("total = " + total);

  }

}

posted on 2011-05-03 20:26  孤独的猫  阅读(140)  评论(0编辑  收藏  举报