{"id":886,"date":"2010-01-23T13:28:00","date_gmt":"2010-01-23T05:28:00","guid":{"rendered":""},"modified":"2013-11-24T20:46:30","modified_gmt":"2013-11-24T12:46:30","slug":"%e6%9c%80%e4%b8%ba%e5%a5%87%e6%80%aa%e7%9a%84%e7%a8%8b%e5%ba%8f%e8%af%ad%e8%a8%80%e7%9a%84%e7%89%b9%e6%80%a7","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/886.html","title":{"rendered":"\u6700\u4e3a\u5947\u602a\u7684\u7a0b\u5e8f\u8bed\u8a00\u7684\u7279\u6027"},"content":{"rendered":"<p>1\u3001C\u8bed\u8a00\u4e2d\u7684\u6570\u7ec4<\/p>\n<p>\u5728C\/C++\u4e2d\uff0ca[10] \u53ef\u4ee5\u5199\u6210 10[a]<\/p>\n<p>\u201cHello World\u201d[i] \u4e5f\u53ef\u4ee5\u5199\u6210 i[&#8220;Hello World&#8221;]<\/p>\n<p>\u8fd9\u6837\u7684\u7279\u6027\u662f\u4e0d\u662f\u5f88\u602a\u5f02\uff1f\u5982\u679c\u4f60\u60f3\u77e5\u9053\u4e3a\u4ec0\u4e48\u7684\u8bdd\uff0c\u4f60\u53ef\u4ee5\u770b\u770b\u672c\u7ad9\u7684\u8fd9\u7bc7\u6587\u7ae0\u2014\u2014\u300aC\u8bed\u8a00\u7684\u8c1c\u9898\u300b\u4e2d\u7684\u7b2c12\u9898\u3002<\/p>\n<p>2\u3001\u5728Javascript\u4e2d<\/p>\n<p>\u20195\u2032 + 3 \u7684\u7ed3\u679c\u662f\uff1a\u201953\u2032<br \/>\n\u20195\u2032 \u2013 3 \u7684\u7ed3\u679c\u662f\uff1a2<\/p>\n<p>3\u3001C\/C++\u4e2d\u7684Trigraphs<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nint main() {\r\n   cout &lt;&lt; &quot;LOL??!&quot;;\r\n}\r\n<\/pre>\n<p>\u4e0a\u9762\u7684\u8fd9\u6bb5\u7a0b\u5e8f\u4f1a\u8f93\u51fa\uff1a \u201cLOL|\u201d\uff0c\u8fd9\u662f\u56e0\u4e3a ??! \u88ab\u8f6c\u6210\u4e86 | \uff0c\u5173\u4e8eTrigraphs\uff0c\u4e0b\u9762\u6709\u4e2a\u8868\u683c\uff1a<\/p>\n<p>??= #<br \/>\n??( [<br \/>\n??\/ \\<br \/>\n??) ]<br \/>\n??\u2019 ^<br \/>\n??&lt; { ??! | ??&gt; }<br \/>\n??- ~<\/p>\n<p>4\u3001JavaScript \u7684\u6761\u4ef6\u8868<\/p>\n<p>\u770b\u5230\u4e0b\u9762\u8fd9\u4e2a\u8868\uff0c\u4e0d\u96be\u7406\u89e3\u4e3a\u4ec0\u4e48Javascript\u7a0b\u5e8f\u5458\u4e3a\u4ec0\u4e48\u75db\u82e6\u4e86\u2014\u2014\u300aJavascript\u7a0b\u5e8f\u5458\u5634\u6700\u810f??\u300b<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n''        ==   '0'           \/\/false\r\n0         ==   ''            \/\/true\r\n0         ==   '0'           \/\/true\r\nfalse     ==   'false'       \/\/false\r\nfalse     ==   '0'           \/\/true\r\nfalse     ==   undefined     \/\/false\r\nfalse     ==   null          \/\/false\r\nnull      ==   undefined     \/\/true\r\n&quot; \\t\\r\\n&quot; ==   0             \/\/true\r\n<\/pre>\n<p>5\u3001Java\u7684Integer cache<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nInteger foo = 1000;\r\nInteger bar = 1000;\r\n\r\nfoo &lt;= bar; \/\/ true\r\nfoo &gt;= bar; \/\/ true\r\nfoo == bar; \/\/ false\r\n\r\n\/\/\u7136\u540e\uff0c\u5982\u679c\u4f60\u7684 foo \u548c bar \u7684\u503c\u5728 127 \u548c -128 \u4e4b\u95f4\uff08\u5305\u62ec\uff09\r\n\/\/\u90a3\u4e48\uff0c\u5176\u884c\u4e3a\u5219\u6539\u53d8\u4e86\uff1a\r\n\r\nInteger foo = 42;\r\nInteger bar = 42;\r\n\r\nfoo &lt;= bar; \/\/ true\r\nfoo &gt;= bar; \/\/ true\r\nfoo == bar; \/\/ true\u4e3a\u4ec0\u4e48\u4f1a\u8fd9\u6837\u5462\uff1f\u4f60\u9700\u8981\u4e86\u89e3\u4e00\u4e0bJava Interger Cache\uff0c\u4e0b\u9762\u662f\u76f8\u5173\u7684\u7a0b\u5e8f\uff0c\u6ce8\u610f\u5176\u4e2d\u7684\u6ce8\u91ca\r\n\r\n\/**\r\n     * Returns a &lt;tt&gt;integer instance representing the specified\r\n     * &lt;tt&gt;int value.\r\n     * If a new &lt;tt&gt;integer instance is not required, this method\r\n     * should generally be used in preference to the constructor\r\n     * &lt;a href=&quot;mailto:{@link&quot;&gt;{@link #integer(int)}, as this method is likely to yield\r\n     * significantly better space and time performance by caching\r\n     * frequently requested values.\r\n     *\r\n     * @param  i an &lt;code&gt;int value.\r\n     * @return a &lt;tt&gt;integer instance representing i.\r\n     * @since  1.5\r\n     *\/\r\n    public static Integer valueOf(int i) {\r\n        if(i &gt;= -128 &amp;&amp; i &lt;= IntegerCache.high)\r\n            return IntegerCache.cache&#x5B;i + 128];\r\n        else\r\n            return new Integer(i);\r\n    }\r\n<\/pre>\n<p>5\u3001Perl\u7684\u90a3\u4e9b\u5947\u602a\u7684\u53d8\u91cf<\/p>\n<p>$.<br \/>\n$_<br \/>\n$_#<br \/>\n$$<br \/>\n$[<br \/>\n@_\u5176\u6240\u6709\u7684\u8fd9\u4e9b\u602a\u5f02\u7684\u53d8\u91cf\u8bf7\u53c2\u770b\uff1apics\/www.kichwa.com\/quik_ref\/spec_variables.html<\/p>\n<p>6\u3001Java\u7684\u5f02\u5e38\u8fd4\u56de<\/p>\n<p>\u8bf7\u770b\u4e0b\u9762\u8fd9\u6bb5\u7a0b\u5e8f\uff0c\u4f60\u89c9\u5f97\u5176\u8fd4\u56detrue\u8fd8\u662ffalse\uff1f<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\ntry {\r\n    return true;\r\n} finally {\r\n    return false;\r\n}\r\n<\/pre>\n<p>\u5728 javascript \u548cpython\u4e0b\uff0c\u5176\u884c\u4e3a\u548cJava\u7684\u662f\u4e00\u6837\u7684\u3002<\/p>\n<p>7\u3001C\u8bed\u8a00\u4e2d\u7684Duff device<\/p>\n<p>\u4e0b\u9762\u7684\u8fd9\u6bb5\u7a0b\u5e8f\u4f60\u80fd\u770b\u5f97\u61c2\u5417\uff1f\u8fd9\u5c31\u662f\u6240\u8c13\u7684Duff Device\uff0c\u76f8\u5f53\u7684\u602a\u5f02\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nvoid duff_memcpy( char* to, char* from, size_t count ) {\r\n    size_t n = (count+7)\/8;\r\n    switch( count%8 ) {\r\n    case 0: do{ *to++ = *from++;\r\n    case 7:     *to++ = *from++;\r\n    case 6:     *to++ = *from++;\r\n    case 5:     *to++ = *from++;\r\n    case 4:     *to++ = *from++;\r\n    case 3:     *to++ = *from++;\r\n    case 2:     *to++ = *from++;\r\n    case 1:     *to++ = *from++;\r\n            }while(--n&gt;0);\r\n    }\r\n}\r\n<\/pre>\n<p>8\u3001PHP\u4e2d\u7684\u5b57\u7b26\u4e32\u5f53\u51fd\u6570\u7528<\/p>\n<p>PHP\u4e2d\u7684\u67d0\u4e9b\u7528\u6cd5\u4e5f\u662f\u5f88\u602a\u5f02\u7684<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n$x = &quot;foo&quot;;\r\nfunction foo(){ echo &quot;wtf&quot;; }\r\n$x();\r\n<\/pre>\n<p>9\u3001\u5728C++\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u7a7a\u6307\u9488\u8c03\u7528\u9759\u6001\u51fd\u6570<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nclass Foo {\r\n  public:\r\n    static void bar() {\r\n      std::cout &lt;&lt; &quot;bar()&quot; &lt;&lt; std::endl;\r\n    }\r\n};\r\n\r\nint main(void) {\r\n  Foo * foo = NULL;\r\n  foo-&gt;bar(); \/\/=&gt; WTF!?\r\n  return 0; \/\/ Ok!\r\n}\r\n<\/pre>\n<p>\u5475\u5475\u3002\u7684\u786e\u662f\u633a\u602a\u5f02\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001C\u8bed\u8a00\u4e2d\u7684\u6570\u7ec4 \u5728C\/C++\u4e2d\uff0ca[10] \u53ef\u4ee5\u5199\u6210 10[a] \u201cHello World\u201d[i] \u4e5f\u53ef\u4ee5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-886","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=886"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/886\/revisions"}],"predecessor-version":[{"id":5174,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/886\/revisions\/5174"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}