home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap12 / bug.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-07  |  595 b   |  35 lines

  1. /* bug.c  --  shows how different levels of debugging  */
  2. /*            output can be produced using #if         */
  3.  
  4. #define DEBUG_LEVEL 2      /* 0 = none, 1-2 for debug  */
  5. #include <stdio.h>
  6.  
  7. main()
  8. {
  9.     int ret;
  10.  
  11. #if (DEBUG_LEVEL == 2)
  12.     fprintf(stderr, "Entering main()\n");
  13. #endif
  14.  
  15. #if (DEBUG_LEVEL == 1)
  16.     fprintf(stderr, "Calling sub()\n");
  17. #endif
  18.  
  19.     ret = sub();
  20.  
  21. #if (DEBUG_LEVEL == 1)
  22.     fprintf(stderr, "sub() returned %d\n", ret);
  23. #endif
  24.  
  25. #if (DEBUG_LEVEL == 2)
  26.     fprintf(stderr, "Leaving main()\n");
  27. #endif
  28.  
  29. }
  30.  
  31. sub()
  32. {
  33.     return (5);
  34. }
  35.