ãããããã¯ãã©ã¤ã°ã©ãã使ã£ã!! â ãããããããªããªã£ã
å¥ã«ä½¿ãå¿ è¦ã«è¿«ããã訳ã§ã¯ç¡ãã®ã§ããã"ãã©ã¤ã°ã©ã"ã¨ãããã®ã使ã£ãããããã°ã©ãã³ã°è¨èªã®ã½ã¼ã¹ã³ã¼ãã®ããåæ©çã§ç°¡åãªã³ã¼ãã®ãµã³ãã«ããã¡ãã«ãªãã¾ãã
??=include <iostream> int main()??< unsigned a??(??)=??<1,2,3??>; std::cout<<??-((a??(0??)??!a??(1??))-a??(2??)); ??>
"ããããã°ã©ãã³ã°è¨èª"ã¨è¨ãã¾ãããã©ãè¦ã¦ãC++ãªæ°ã¯ãã¾ããï¼C++ã§ãããããã¾ãã§é£èªåããããã®æ§ãªé£è§£ãªã³ã¼ãã«è¦ãã¾ããï¼å®ã¯ç°¡åã§ãã
ãã®ã³ã¼ããGCC-4.7.1/openSUSE-12.2(x86_64)ã§å®è¡ã¾ã§ããã¨ã
4294967295
ã¨è¡¨ç¤ºããã¾ãã(42ãããªãç¹ã¯ãäºæ¿ä¸ãã)
å®ã¯å ã®ã³ã¼ãã¯C++è¦æ ¼ã§ããã£ããå®ç¾©ããã¦ãã"ãã©ã¤ã°ã©ã"(§2.4 Trigraph sequence)ã¨ããæ©è½ã使ã£ã¦ã³ã¼ããããã®ãåãã½ã¼ã¹ããã©ã¤ã°ã©ãã使ããã«ã³ã¼ãããã¨æ¬¡ã®éããããã¯æåã«ç¤ºããã³ã¼ãã¨å®å ¨ã«ç価ã«ã³ã³ãã¤ã©ã¼ã«è©ä¾¡ããã¾ãã
#include <iostream> int main(){ unsigned a[]={1,2,3}; std::cout<<~((a[0]|a[1])-a[2]); }
ãããªãã¨èª°ã§ããããã¾ããã»ï½ã»ï¼
æçµçã«ã¯å¦çç³»ä¾åã®unsignedåã®æ大å¤ã表示ãã¦ããã ãã§ãã0xFFFFFFFFã¨ãããããã®è¨ç®ãä½ã¦è¨ãäºã¯ç¡ã1ã¨2ã®OR(|)ãã¤ã¾ã3ããããã3ãå¼ãã¦0ãããã«NOT(~)ããã¦ããã¨ããã¡ãã£ã¨ãããã³ã»ã³ã¹ããããããããã©ã¤ã°ã©ããªããã®ã使ãã¨å ã®éãé£èªåããããå¿è«ãã©ã¤ã°ã©ãã¯é£èªåã®çºã«ããæ©è½ã§ã¯ãªãã # \ ^ [ ] | { } ~ ã®9ã¤ã®è¨å·ã®å ¥åãå°é£ãªç°å¢ã§ãC++ã®ã½ã¼ã¹ã³ã¼ããè¨è¿°ã§ããããã«ã ??X ã®å½¢å¼ã®3æåã§ã²ã¨åºã¾ãã¨è¦åããã©ã¤ã°ã©ã(tri-graph; æ訳:3ã¤ãªãæå)ãå®ç¾©ãã¦ãããã¨ããããç¥è©±ã®æ代ã«ãªãã¤ã¤ãããããªæ話ããç¾ä»£ã«åãç¶ããç¶ãã¦ããè¨èªä»æ§ã ã£ãããã¾ãã
â¦å°ãªãã¨ãæ¥æ¬ã§ã¯ãã©ã¤ã°ã©ããå¿ è¦ã¨ããæ§ãªç°å¢ã«ã¯ééãã¾ããããASCIIãæ±ããç°å¢ã¯åé¡ã«ãªãã¾ããããã大æã®æåã³ã¼ãåºå®ã®æ±ç¨æ©æ代ã®éºç©ãªãã§ãããããã¼â¦ããããã«ç§ã¯çã§æ±ç¨æ©ã使ã£ã¦ããæ代ã§ã¯ãªãã®ã§æ¬å½ãã¾ã§ã¯ç¥ãã¾ããããã©ã
// ã¡ãªã¿ã«C++ã®è¨èªä»æ§æ¸ããèªãã§å± ãªãã®ã§ANSIã«è¿½å ãããçµç·¯ã ã¨ãããã¯Cããªããã»ããµã¼ã®ã¨ãEBCDICæåã³ã¼ãã¨ãæ°ã«ãªã人ã¯èª¿ã¹ããããã¨æããã»ï½ã»