// filename:c2011-5-2-1-1-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 5.2.1.1 Trigraph sequences // 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. //EXAMPLE 1 // ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??) // becomes // #define arraycheck(a, b) a[b] || b[a] //EXAMPLE 2 The following source line // printf("Eh???/n"); // becomes (after replacement of the trigraph sequence ??/) // printf("Eh?\n"); // add initialization of b because of GCC4.9 cause "Segmentation fault: 11" ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??) #include int main(void){ int a[1],b=0; return printf("%d Eh???/n",arraycheck(a,b)); } // warning: trigraph ignored [-Wtrigraphs] // cc -trigraphs c2011-5-2-1-1-ex.c or gcc -trigraphs c2011-5-2-1-1-ex.c // 1 Eh?