home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / CMTTESTS.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  2KB  |  105 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4.  * Test file for Comment Utilities.
  5.  *   This file should be compilable before AND after comment
  6.  *   conversion or removal.
  7.  *
  8.  *   Jari Laaksonen
  9.  *   Arkkitehdinkatu 30 A 2
  10.  *   FIN-33720 Tampere
  11.  *   FINLAND
  12.  *   Fidonet:  2:221/360.20
  13.  *   Internet: jla@to.icl.fi
  14.  */
  15.  
  16. #include <stdio.h>
  17.  
  18. int main()
  19. {
  20. /*
  21.   comment */ int a; /* comment continues in same line
  22. */
  23.  
  24. /* C comment */ int b; // C++ comment
  25.  
  26. /*
  27.    C comment
  28. */ int c; // C++ comment
  29.  
  30.   /**** comment ****/
  31.   //*** comment ****/
  32.  
  33.   char ch = '\"'; /* double quote but not a start of a string */
  34.  
  35.   char x1[]       // here we...
  36.     = "";
  37.   char x2[] = ""; /* ...have some... */
  38.   char x3[] = ""  /* ...empty... */ ;
  39.   char x4[] = ""; // ...strings.
  40.  
  41.   printf ("this is a string");          /* C comment */
  42.   printf ("this is \" another string"); // C++ comment
  43.   printf ("this is \' another string"); // C++ comment
  44.   printf ("yet another \\ string");     // C++ comment
  45.  
  46. /* C comment in one line */
  47.  
  48. // C++ comment in one line
  49.  
  50. /* C comment
  51.    in several
  52.    lines
  53.    printf ("// not a comment");
  54. */
  55.  
  56. /* C comment
  57.    in several lines */
  58.  
  59. // C comment in C++ comment: /* comment */
  60.  
  61. /* C++ comment in C comment: // comment */
  62.  
  63. /*
  64.    C++ comment in C comment: // comment
  65. */
  66.  
  67.   printf ("this /* is not // a comment * * ! ");
  68.   printf ("this /* is not a comment * * ! ");
  69.   printf ("this // is not a comment * * ! ");
  70.  
  71.   printf ("this */ is not a comment * * ! ");
  72.  
  73. // C++ comment
  74. // C++ comment /
  75.  
  76. // C++ comment in \
  77.    several        \
  78.    lines
  79.  
  80. /\
  81. / C++ comment
  82.  
  83.   a = 0; /\
  84. * C comment */
  85.  
  86.   /* C       *\
  87.    *         *
  88.   \* comment */
  89.  
  90. /* C comment \
  91.    C comment */
  92.  
  93. // char s[] = "string \
  94.                string";
  95.  
  96. // not a multiline C++ \comment
  97.   b = 0;
  98.  
  99. // not a multiline C++ \ comment
  100.   c = 0;
  101.  
  102.   return 0;
  103. }
  104. // end file
  105.