// filename:c2011-6-4-7-ex.c // original examples and/or notes: // (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011 // http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf // C2011 6.4.9 Comments // compile and output mechanism: // (c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.xx, 2013 // compile errors and/or wornings: // 1 (c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn) // Target: x86_64-apple-darwin11.4.2 //Thread model: posix // (c) LLVM 2003-2009 University of Illinois at Urbana-Champaign. // 2 gcc-4.9 (GCC) 4.9.0 20131229 (experimental) // Copyright (C) 2013 Free Software Foundation, Inc. //int main(void){ #define AB "a//b" //four-character string literal #include "//e" // undefined behavior #define glue(x,y) x##y //** glue(/,/) k(); // syntax error, not comment //** //c2011-6-4-9-ex.c:19:6: error: pasting "/" and "/" does not give a valid preprocessing token // glue(/,/) k(); // syntax error, not comment // ^ // c2011-6-4-9-ex.c:18:19: note: in definition of macro 'glue' // #define glue(x,y) x##y // ^ int l(void){printf("l() ");}; int main(void){ /*//*/ l(); // equivalent to l(); // */ // comment, not syntax error int f,g,h; f = g/**//h; // equivalent tof = g / h; //\ i(); // part of a two-line comment /\ / j(); // part of a two-line comment int m,n=1,p=2; m = n//**/o + p; // equivalent to m = n + p; return printf("6.4.9 Comments %d %d %s\n",f,m,AB); } // output LLVM 3.2 & GCC4.9 //l() 6.4.9 Comments 0 3 a//b