{"id":108079,"date":"2026-09-20T22:32:44","date_gmt":"2026-09-20T14:32:44","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/108079.html"},"modified":"2026-09-20T22:32:44","modified_gmt":"2026-09-20T14:32:44","slug":"%e3%80%90c-primer-plus-%e7%b2%be%e8%af%bb%e3%80%91day1","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/108079.html","title":{"rendered":"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1"},"content":{"rendered":"<\/p>\n<h4>\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 \u4ece\u6570\u636e\u5e95\u5c42\u51fa\u53d1&#xff1a;\u6574\u6570\u8865\u7801\u3001\u6d6e\u70b9\u6570IEEE 754\u4e0e\u5927\u5c0f\u7aef\u7684\u6df1\u5ea6\u62c6\u89e3<\/h4>\n<ul>\n<li>&#x1f3af; \u524d\u8a00<\/li>\n<li>\u4e00\u3001C\u8bed\u8a00\u4e3a\u4ec0\u4e48\u503c\u5f97\u5b66&#xff1a;\u4ece&#034;\u7cfb\u7edf\u7ea7\u8bed\u8a00&#034;\u7684\u672c\u8d28\u8bf4\u8d77<\/li>\n<li>\u4e8c\u3001\u7b2c\u4e00\u4e2aC\u7a0b\u5e8f\u80cc\u540e&#xff1a;\u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6<\/li>\n<li>\n<ul>\n<li>\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5206\u8fd9\u4e48\u591a\u9636\u6bb5&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001\u6574\u6570&#xff1a;\u4ece\u539f\u7801\u53cd\u7801\u5230\u8865\u7801&#xff0c;\u4e00\u6b21\u8bf4\u6e05\u695a<\/li>\n<li>\n<ul>\n<li>3.1 \u539f\u7801\u3001\u53cd\u7801\u3001\u8865\u7801&#xff1a;\u4e09\u5144\u5f1f\u7684\u6545\u4e8b<\/li>\n<li>3.2 \u8865\u7801\u7684\u6570\u5b66\u672c\u8d28<\/li>\n<li>3.3 \u6574\u6570\u6ea2\u51fa&#xff1a;\u672a\u5b9a\u4e49\u884c\u4e3a<\/li>\n<li>\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48\u6709\u7b26\u53f7\u6ea2\u51fa\u662f UB&#xff0c;\u65e0\u7b26\u53f7\u6ea2\u51fa\u5374\u5b9a\u4e49\u660e\u786e&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>\u56db\u3001\u6d6e\u70b9\u6570&#xff1a;IEEE 754 \u6807\u51c6\u7684\u7cbe\u5999\u4e0e\u9677\u9631<\/li>\n<li>\n<ul>\n<li>4.1 \u79d1\u5b66\u8ba1\u6570\u6cd5&#xff1a;\u6d6e\u70b9\u6570\u7684\u57fa\u672c\u601d\u60f3<\/li>\n<li>4.2 IEEE 754 \u5355\u7cbe\u5ea6&#xff08;float&#xff09;\u7684\u5185\u5b58\u5e03\u5c40<\/li>\n<li>4.3 \u4e3a\u4ec0\u4e48 0.1 &#043; 0.2 \u2260 0.3&#xff1f;<\/li>\n<li>4.4 \u7279\u6b8a\u503c&#xff1a;\u65e0\u7a77\u5927\u3001NaN\u3001\u975e\u89c4\u683c\u5316\u6570<\/li>\n<li>\u6df1\u5ea6\u601d\u8003&#xff1a;float \u548c double \u7684\u7cbe\u5ea6\u5230\u5e95\u5dee\u591a\u5c11&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>\u4e94\u3001char \u7c7b\u578b&#xff1a;\u6709\u7b26\u53f7\u8fd8\u662f\u65e0\u7b26\u53f7&#xff1f;\u8fd9\u662f\u4e2a\u95ee\u9898<\/li>\n<li>\n<ul>\n<li>5.1 \u4e3a\u4ec0\u4e48 char \u7684\u7b26\u53f7\u6027\u4e0d\u786e\u5b9a&#xff1f;<\/li>\n<li>5.2 \u600e\u4e48\u5904\u7406&#xff1f;<\/li>\n<li>\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48 C \u8bed\u8a00\u91cc\u6709\u8fd9\u4e48\u591a&#034;\u5b9e\u73b0\u5b9a\u4e49&#034;\u548c&#034;\u672a\u5b9a\u4e49\u884c\u4e3a&#034;&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>\u516d\u3001\u5927\u5c0f\u7aef&#xff1a;\u591a\u5b57\u8282\u6570\u636e\u7684\u5b58\u50a8\u987a\u5e8f<\/li>\n<li>\n<ul>\n<li>6.1 \u4ec0\u4e48\u662f\u5927\u5c0f\u7aef&#xff1f;<\/li>\n<li>6.2 \u4e3a\u4ec0\u4e48\u4f1a\u6709\u4e24\u79cd\u5b57\u8282\u5e8f&#xff1f;<\/li>\n<li>6.3 \u7528 C \u4ee3\u7801\u5224\u65ad\u5927\u5c0f\u7aef<\/li>\n<li>\u6df1\u5ea6\u601d\u8003&#xff1a;\u9664\u4e86\u5927\u5c0f\u7aef&#xff0c;\u8fd8\u6709&#034;\u4e2d\u95f4\u7aef&#034;\u5417&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>&#x1f4dd; \u603b\u7ed3<\/li>\n<li>&#x1f4da; \u53c2\u8003\u8d44\u6599<\/li>\n<\/ul>\n<p>\u672c\u6587\u662f\u300aC Primer Plus\u300b\u4e03\u65e5\u9605\u8bfb\u8ba1\u5212\u7684\u7b2c\u4e00\u5929&#xff0c;\u8986\u76d6\u7b2c1-3\u7ae0&#xff08;\u521d\u8bc6C\u8bed\u8a00\u3001C\u8bed\u8a00\u6982\u8ff0\u3001\u6570\u636e\u548cC&#xff09;\u3002\u867d\u7136\u662f\u5165\u95e8\u7ae0\u8282&#xff0c;\u4f46\u6211\u60f3\u4ece\u6570\u636e\u5e95\u5c42\u5207\u5165&#xff0c;\u6df1\u5165\u5230\u8865\u7801\u8fd0\u7b97\u3001IEEE 754 \u6d6e\u70b9\u6807\u51c6\u3001\u5927\u5c0f\u7aef\u5b58\u50a8\u3001char \u7684\u7b26\u53f7\u6027\u7b49\u771f\u6b63\u80fd\u4f53\u73b0 C \u8bed\u8a00&#034;\u9760\u8fd1\u786c\u4ef6&#034;\u7279\u6027\u7684\u77e5\u8bc6\u70b9\u3002<\/p>\n<hr \/>\n<h2>&#x1f3af; \u524d\u8a00<\/h2>\n<p>\u8fd9\u662f\u6211\u8bfb\u300aC Primer Plus\u300b\u7684\u7b2c\u4e00\u5929\u7b14\u8bb0\u3002<\/p>\n<p>\u8bf4\u5b9e\u8bdd&#xff0c;\u7b2c1-3\u7ae0\u7684\u5185\u5bb9\u770b\u8d77\u6765\u5f88&#034;\u57fa\u7840&#034;\u2014\u2014C\u8bed\u8a00\u5386\u53f2\u3001\u7b2c\u4e00\u4e2a Hello World \u7a0b\u5e8f\u3001\u57fa\u672c\u6570\u636e\u7c7b\u578b&#xff0c;\u5f88\u591a\u4eba\u53ef\u80fd\u7ffb\u7ffb\u5c31\u8fc7\u53bb\u4e86\u3002\u4f46\u6211\u89c9\u5f97\u6070\u6070\u662f\u8fd9\u4e9b&#034;\u57fa\u7840&#034;\u91cc\u85cf\u7740 C \u8bed\u8a00\u6700\u672c\u8d28\u7684\u4e1c\u897f&#xff1a;\u5b83\u4e3a\u4ec0\u4e48\u80fd\u6210\u4e3a\u7cfb\u7edf\u7ea7\u7f16\u7a0b\u8bed\u8a00&#xff1f;\u5b83\u548c\u786c\u4ef6\u4e4b\u95f4\u5230\u5e95\u6709\u591a\u8fd1&#xff1f;<\/p>\n<p>\u8fd9\u7bc7\u7b14\u8bb0\u6211\u4e0d\u60f3\u505c\u7559\u5728&#034;int \u662f\u6574\u578b\u3001float \u662f\u6d6e\u70b9\u578b&#034;\u8fd9\u79cd\u6d45\u5c42\u9762&#xff0c;\u800c\u662f\u60f3\u5f80\u4e0b\u6316\u51e0\u5c42&#xff1a;<\/p>\n<ul>\n<li>\u6574\u6570\u4e3a\u4ec0\u4e48\u7528\u8865\u7801\u5b58\u50a8&#xff1f;\u8865\u7801\u7684\u6570\u5b66\u539f\u7406\u662f\u4ec0\u4e48&#xff1f;<\/li>\n<li>\u6d6e\u70b9\u6570\u4e3a\u4ec0\u4e48\u4e0d\u7cbe\u786e&#xff1f;IEEE 754 \u6807\u51c6\u5230\u5e95\u505a\u4e86\u4ec0\u4e48&#xff1f;<\/li>\n<li>char \u5230\u5e95\u662f\u6709\u7b26\u53f7\u8fd8\u662f\u65e0\u7b26\u53f7&#xff1f;\u4e3a\u4ec0\u4e48\u8fd9\u662f\u4e2a&#034;\u5b9e\u73b0\u5b9a\u4e49&#034;\u7684\u95ee\u9898&#xff1f;<\/li>\n<li>\u5927\u5c0f\u7aef\u662f\u600e\u4e48\u56de\u4e8b&#xff1f;\u600e\u4e48\u7528 C \u4ee3\u7801\u5224\u65ad\u5f53\u524d\u5e73\u53f0\u7684\u5b57\u8282\u5e8f&#xff1f;<\/li>\n<\/ul>\n<p>\u5148\u4ece\u4e00\u5f20\u5168\u4e66\u77e5\u8bc6\u4f53\u7cfb\u56fe\u5f00\u59cb&#xff0c;\u4eca\u5929\u6211\u4eec\u805a\u7126\u5de6\u4e0b\u89d2&#034;\u6570\u636e\u8868\u793a&#034;\u8fd9\u4e00\u5757\u3002<\/p>\n<hr \/>\n<p>  #mermaid-svg-cOCrRhTiGRMtKXPK{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-cOCrRhTiGRMtKXPK .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-cOCrRhTiGRMtKXPK .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-cOCrRhTiGRMtKXPK .error-icon{fill:#552222;}#mermaid-svg-cOCrRhTiGRMtKXPK .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-cOCrRhTiGRMtKXPK .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-cOCrRhTiGRMtKXPK .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-cOCrRhTiGRMtKXPK .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-cOCrRhTiGRMtKXPK .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-cOCrRhTiGRMtKXPK .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-cOCrRhTiGRMtKXPK .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-cOCrRhTiGRMtKXPK .marker{fill:#333333;stroke:#333333;}#mermaid-svg-cOCrRhTiGRMtKXPK .marker.cross{stroke:#333333;}#mermaid-svg-cOCrRhTiGRMtKXPK svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-cOCrRhTiGRMtKXPK p{margin:0;}#mermaid-svg-cOCrRhTiGRMtKXPK .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-cOCrRhTiGRMtKXPK .cluster-label text{fill:#333;}#mermaid-svg-cOCrRhTiGRMtKXPK .cluster-label span{color:#333;}#mermaid-svg-cOCrRhTiGRMtKXPK .cluster-label span p{background-color:transparent;}#mermaid-svg-cOCrRhTiGRMtKXPK .label text,#mermaid-svg-cOCrRhTiGRMtKXPK span{fill:#333;color:#333;}#mermaid-svg-cOCrRhTiGRMtKXPK .node rect,#mermaid-svg-cOCrRhTiGRMtKXPK .node circle,#mermaid-svg-cOCrRhTiGRMtKXPK .node ellipse,#mermaid-svg-cOCrRhTiGRMtKXPK .node polygon,#mermaid-svg-cOCrRhTiGRMtKXPK .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-cOCrRhTiGRMtKXPK .rough-node .label text,#mermaid-svg-cOCrRhTiGRMtKXPK .node .label text,#mermaid-svg-cOCrRhTiGRMtKXPK .image-shape .label,#mermaid-svg-cOCrRhTiGRMtKXPK .icon-shape .label{text-anchor:middle;}#mermaid-svg-cOCrRhTiGRMtKXPK .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-cOCrRhTiGRMtKXPK .rough-node .label,#mermaid-svg-cOCrRhTiGRMtKXPK .node .label,#mermaid-svg-cOCrRhTiGRMtKXPK .image-shape .label,#mermaid-svg-cOCrRhTiGRMtKXPK .icon-shape .label{text-align:center;}#mermaid-svg-cOCrRhTiGRMtKXPK .node.clickable{cursor:pointer;}#mermaid-svg-cOCrRhTiGRMtKXPK .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-cOCrRhTiGRMtKXPK .arrowheadPath{fill:#333333;}#mermaid-svg-cOCrRhTiGRMtKXPK .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-cOCrRhTiGRMtKXPK .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-cOCrRhTiGRMtKXPK .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-cOCrRhTiGRMtKXPK .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-cOCrRhTiGRMtKXPK .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-cOCrRhTiGRMtKXPK .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-cOCrRhTiGRMtKXPK .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-cOCrRhTiGRMtKXPK .cluster text{fill:#333;}#mermaid-svg-cOCrRhTiGRMtKXPK .cluster span{color:#333;}#mermaid-svg-cOCrRhTiGRMtKXPK div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-cOCrRhTiGRMtKXPK .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-cOCrRhTiGRMtKXPK rect.text{fill:none;stroke-width:0;}#mermaid-svg-cOCrRhTiGRMtKXPK .icon-shape,#mermaid-svg-cOCrRhTiGRMtKXPK .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-cOCrRhTiGRMtKXPK .icon-shape p,#mermaid-svg-cOCrRhTiGRMtKXPK .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-cOCrRhTiGRMtKXPK .icon-shape .label rect,#mermaid-svg-cOCrRhTiGRMtKXPK .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-cOCrRhTiGRMtKXPK .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-cOCrRhTiGRMtKXPK .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-cOCrRhTiGRMtKXPK :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span style=\"color:#fff !important\" class=\"nodeLabel\"><\/p>\n<p>C\u8bed\u8a00\u5165\u95e8\u77e5\u8bc6\u4f53\u7cfb<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u8bed\u8a00\u57fa\u7840\u7b2c1-2\u7ae0<\/p>\n<p><\/span><\/p>\n<p>         <span style=\"color:#fff !important\" class=\"nodeLabel\"><\/p>\n<p>\u6570\u636e\u4e0e\u7c7b\u578b\u7b2c3\u7ae0<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u6d41\u7a0b\u63a7\u5236\u7b2c6-7\u7ae0<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u51fd\u6570\u4e0e\u6307\u9488\u7b2c9\u7ae0<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u6570\u7ec4\u4e0e\u5b57\u7b26\u4e32\u7b2c10-11\u7ae0<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u5185\u5b58\u7ba1\u7406\u7b2c12\u7ae0<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u9ad8\u7ea7\u6570\u636e\u7b2c14-17\u7ae0<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u6574\u6570\u8865\u7801<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>IEEE 754\u6d6e\u70b9<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u5927\u5c0f\u7aef\u4e0e\u5bf9\u9f50<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>char\u7b26\u53f7\u6027\u4e0e\u53ef\u79fb\u690d<\/p>\n<p><\/span><\/p>\n<hr \/>\n<h2>\u4e00\u3001C\u8bed\u8a00\u4e3a\u4ec0\u4e48\u503c\u5f97\u5b66&#xff1a;\u4ece&#034;\u7cfb\u7edf\u7ea7\u8bed\u8a00&#034;\u7684\u672c\u8d28\u8bf4\u8d77<\/h2>\n<p>\u7b2c\u4e00\u7ae0\u4ecb\u7ecd\u4e86 C \u8bed\u8a00\u7684\u8d77\u6e90\u548c\u7279\u70b9&#xff0c;\u5176\u4e2d\u6700\u6253\u52a8\u6211\u7684\u4e00\u53e5\u8bdd\u662f&#xff1a;\u201cC\u8bed\u8a00\u5177\u6709\u901a\u5e38\u662f\u6c47\u7f16\u8bed\u8a00\u624d\u5177\u6709\u7684\u5fae\u8c03\u63a7\u5236\u80fd\u529b\u201d\u3002<\/p>\n<p>\u8fd9\u53e5\u8bdd\u7684\u5206\u91cf&#xff0c;\u521d\u5b66\u7684\u65f6\u5019\u53ef\u80fd\u4f53\u4f1a\u4e0d\u5230\u3002\u4f46\u4f60\u8d8a\u5f80\u4e0b\u5b66\u5c31\u8d8a\u4f1a\u53d1\u73b0&#xff1a;C \u8bed\u8a00\u51e0\u4e4e\u6ca1\u6709&#034;\u9ed1\u7bb1&#034;\u2014\u2014\u5185\u5b58\u91cc\u7684\u6bcf\u4e00\u4e2a\u5b57\u8282\u662f\u4ec0\u4e48\u3001\u53d8\u91cf\u5b58\u5728\u6808\u4e0a\u8fd8\u662f\u5806\u4e0a\u3001\u51fd\u6570\u8c03\u7528\u65f6\u6808\u5e27\u600e\u4e48\u53d8\u5316&#xff0c;\u8fd9\u4e9b\u4f60\u4e0d\u4ec5\u80fd\u641e\u6e05\u695a&#xff0c;\u8fd8\u80fd\u624b\u52a8\u63a7\u5236\u3002\u8fd9\u662f Python\u3001Java \u7b49\u9ad8\u7ea7\u8bed\u8a00\u5b8c\u5168\u4e0d\u540c\u7684\u601d\u7ef4\u65b9\u5f0f\u3002<\/p>\n<p>C \u8bed\u8a00\u4e4b\u6240\u4ee5\u80fd\u6210\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u3001\u7f16\u8bd1\u5668\u3001\u5d4c\u5165\u5f0f\u7cfb\u7edf\u7684\u9996\u9009\u8bed\u8a00&#xff0c;\u6839\u672c\u539f\u56e0\u5c31\u5728\u4e8e\u5b83\u7684**\u96f6\u5f00\u9500\u62bd\u8c61&#xff08;zero-overhead abstraction&#xff09;**\u54f2\u5b66&#xff1a;\u4f60\u4e0d\u9700\u8981\u7684\u4e1c\u897f&#xff0c;\u4e0d\u4f1a\u8ba9\u4f60\u4ed8\u51fa\u4efb\u4f55\u4ee3\u4ef7\u3002int \u5c31\u662f 4 \u5b57\u8282&#xff08;\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a&#xff09;&#xff0c;\u76f4\u63a5\u5bf9\u5e94 CPU \u7684\u5bc4\u5b58\u5668\u64cd\u4f5c&#xff0c;\u6ca1\u6709\u88c5\u7bb1\u3001\u6ca1\u6709\u5bf9\u8c61\u5934\u3001\u6ca1\u6709\u5783\u573e\u56de\u6536\u3002<\/p>\n<p>&#x1f4a1; \u4e00\u4e2a\u6709\u8da3\u7684\u89c6\u89d2&#xff1a;\u5f88\u591a\u4eba\u8bf4 C \u8bed\u8a00\u662f&#034;\u9ad8\u7ea7\u6c47\u7f16&#034;&#xff0c;\u8fd9\u8bdd\u4e0d\u5b8c\u5168\u51c6\u786e&#xff0c;\u4f46\u4e5f\u4e0d\u5168\u9519\u3002C \u8bed\u8a00\u7684\u6bcf\u4e00\u4e2a\u57fa\u672c\u64cd\u4f5c\u51e0\u4e4e\u90fd\u80fd\u76f4\u63a5\u6620\u5c04\u5230\u673a\u5668\u6307\u4ee4\u3002\u4f60\u5199\u7684 a &#043; b \u5c31\u662f\u4e00\u6761 add \u6307\u4ee4&#xff0c;\u4f60\u5199\u7684 *p \u5c31\u662f\u4e00\u6b21\u5185\u5b58\u89e3\u5f15\u7528\u3002\u8fd9\u79cd&#034;\u6240\u89c1\u5373\u6240\u5f97&#034;\u7684\u900f\u660e\u6027&#xff0c;\u662f\u7406\u89e3\u8ba1\u7b97\u673a\u5e95\u5c42\u5de5\u4f5c\u539f\u7406\u7684\u6700\u4f73\u7a97\u53e3\u3002<\/p>\n<hr \/>\n<h2>\u4e8c\u3001\u7b2c\u4e00\u4e2aC\u7a0b\u5e8f\u80cc\u540e&#xff1a;\u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6<\/h2>\n<p>\u7b2c\u4e8c\u7ae0\u7ed9\u51fa\u4e86\u6700\u7b80\u5355\u7684 C \u7a0b\u5e8f\u793a\u4f8b&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">void<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> num <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">42<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Hello, %d!\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> num<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4e66\u91cc\u8bb2\u4e86\u7f16\u8bd1\u548c\u8fd0\u884c\u7684\u57fa\u672c\u6b65\u9aa4&#xff0c;\u4f46\u6211\u60f3\u8865\u5145\u4e00\u4e2a\u66f4\u5b8c\u6574\u7684\u89c6\u89d2&#xff1a;\u4ece .c \u6587\u4ef6\u5230\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u4e2d\u95f4\u5230\u5e95\u7ecf\u5386\u4e86\u4ec0\u4e48&#xff1f;<\/p>\n<p>\u6574\u4e2a\u8fc7\u7a0b\u5206\u56db\u6b65&#xff1a;\u9884\u5904\u7406 \u2192 \u7f16\u8bd1 \u2192 \u6c47\u7f16 \u2192 \u94fe\u63a5\u3002<\/p>\n<table>\n<tr>\u9636\u6bb5\u8f93\u5165\u8f93\u51fa\u505a\u4e86\u4ec0\u4e48<\/tr>\n<tbody>\n<tr>\n<td>\u9884\u5904\u7406<\/td>\n<td>.c \u6e90\u6587\u4ef6<\/td>\n<td>.i \u9884\u5904\u7406\u540e\u6587\u4ef6<\/td>\n<td>\u5904\u7406 #include\u3001#define\u3001\u6761\u4ef6\u7f16\u8bd1\u7b49\u6307\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>\u7f16\u8bd1<\/td>\n<td>.i \u6587\u4ef6<\/td>\n<td>.s \u6c47\u7f16\u4ee3\u7801<\/td>\n<td>C \u8bed\u8a00\u7ffb\u8bd1\u6210\u6c47\u7f16\u6307\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>\u6c47\u7f16<\/td>\n<td>.s \u6587\u4ef6<\/td>\n<td>.o \u76ee\u6807\u6587\u4ef6<\/td>\n<td>\u6c47\u7f16\u6307\u4ee4\u7ffb\u8bd1\u6210\u673a\u5668\u7801&#xff08;\u4e8c\u8fdb\u5236&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u94fe\u63a5<\/td>\n<td>.o \u6587\u4ef6 &#043; \u5e93<\/td>\n<td>\u53ef\u6267\u884c\u6587\u4ef6<\/td>\n<td>\u5408\u5e76\u76ee\u6807\u6587\u4ef6\u3001\u89e3\u6790\u7b26\u53f7\u5f15\u7528\u3001\u91cd\u5b9a\u4f4d\u5730\u5740<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53ef\u4ee5\u7528\u4e00\u6761\u547d\u4ee4\u770b\u5230\u6bcf\u4e00\u6b65\u7684\u7ed3\u679c&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u53ea\u505a\u9884\u5904\u7406<\/span><br \/>\ngcc <span class=\"token parameter variable\">-E<\/span> hello.c <span class=\"token parameter variable\">-o<\/span> hello.i<\/p>\n<p><span class=\"token comment\"># \u7f16\u8bd1\u5230\u6c47\u7f16<\/span><br \/>\ngcc <span class=\"token parameter variable\">-S<\/span> hello.c <span class=\"token parameter variable\">-o<\/span> hello.s<\/p>\n<p><span class=\"token comment\"># \u6c47\u7f16\u5230\u76ee\u6807\u6587\u4ef6<\/span><br \/>\ngcc <span class=\"token parameter variable\">-c<\/span> hello.c <span class=\"token parameter variable\">-o<\/span> hello.o<\/p>\n<p><span class=\"token comment\"># \u5b8c\u6574\u94fe\u63a5\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6<\/span><br \/>\ngcc hello.c <span class=\"token parameter variable\">-o<\/span> hello<\/p>\n<p>hello.o \u662f\u4e8c\u8fdb\u5236\u7684\u76ee\u6807\u6587\u4ef6&#xff0c;\u91cc\u9762\u5df2\u7ecf\u662f\u673a\u5668\u7801\u4e86&#xff0c;\u4f46\u8fd8\u4e0d\u80fd\u76f4\u63a5\u8fd0\u884c\u2014\u2014\u56e0\u4e3a printf \u51fd\u6570\u7684\u5177\u4f53\u5730\u5740\u8fd8\u6ca1\u586b\u4e0a&#xff0c;\u8981\u7b49\u94fe\u63a5\u5668\u53bb C \u6807\u51c6\u5e93\u91cc\u627e\u5230\u5b83&#xff0c;\u628a\u8c03\u7528\u5730\u5740&#034;\u8865\u4e0a&#034;&#xff0c;\u8fd9\u53eb\u7b26\u53f7\u89e3\u6790\u548c\u91cd\u5b9a\u4f4d\u3002<\/p>\n<hr \/>\n<h3>\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5206\u8fd9\u4e48\u591a\u9636\u6bb5&#xff1f;<\/h3>\n<p>\u95ee&#xff1a;\u7f16\u8bd1\u5668\u4e3a\u4ec0\u4e48\u4e0d\u76f4\u63a5\u4ece\u6e90\u7801\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6&#xff1f;\u975e\u8981\u5206\u9884\u5904\u7406\u3001\u7f16\u8bd1\u3001\u6c47\u7f16\u3001\u94fe\u63a5\u56db\u6b65&#xff1f;<\/p>\n<p>\u7b54&#xff1a;\u8fd9\u5176\u5b9e\u662f\u4e00\u4e2a&#034;\u5173\u6ce8\u70b9\u5206\u79bb&#034;\u7684\u7ecf\u5178\u8bbe\u8ba1&#xff0c;\u6bcf\u4e00\u5c42\u90fd\u6709\u81ea\u5df1\u72ec\u7acb\u7684\u804c\u8d23\u548c\u5b58\u5728\u7406\u7531&#xff1a;<\/p>\n<p>1. \u9884\u5904\u7406\u72ec\u7acb\u7684\u539f\u56e0 \u9884\u5904\u7406\u662f\u7eaf\u6587\u672c\u64cd\u4f5c&#xff08;\u5b8f\u66ff\u6362\u3001\u6587\u4ef6\u5305\u542b\u3001\u6761\u4ef6\u7f16\u8bd1&#xff09;&#xff0c;\u5b83\u6839\u672c\u4e0d\u7406\u89e3 C \u8bed\u6cd5\u3002\u628a\u5b83\u72ec\u7acb\u51fa\u6765&#xff0c;\u65e2\u7b80\u5316\u4e86\u7f16\u8bd1\u5668\u4e3b\u4f53&#xff08;\u4e0d\u7528\u5904\u7406\u6587\u672c\u66ff\u6362\u903b\u8f91&#xff09;&#xff0c;\u4e5f\u8ba9\u5b8f\u673a\u5236\u66f4\u7075\u6d3b\u2014\u2014\u4f60\u751a\u81f3\u53ef\u4ee5\u7528\u9884\u5904\u7406\u5668\u5904\u7406\u975e C \u4ee3\u7801\u3002<\/p>\n<p>2. \u6c47\u7f16\u72ec\u7acb\u7684\u539f\u56e0 \u7f16\u8bd1\u9636\u6bb5\u8f93\u51fa\u6c47\u7f16\u800c\u4e0d\u662f\u76f4\u63a5\u8f93\u51fa\u673a\u5668\u7801&#xff0c;\u662f\u56e0\u4e3a\u6c47\u7f16\u8bed\u8a00\u662f\u673a\u5668\u6307\u4ee4\u7684&#034;\u53ef\u8bfb\u5f62\u5f0f&#034;&#xff0c;\u65b9\u4fbf\u8c03\u8bd5\u548c\u7406\u89e3\u3002\u800c\u4e14\u4e0d\u540c\u67b6\u6784\u7684\u6c47\u7f16\u683c\u5f0f\u4e0d\u540c&#xff0c;\u628a&#034;\u751f\u6210\u6c47\u7f16&#034;\u548c&#034;\u6c47\u7f16\u6210\u673a\u5668\u7801&#034;\u5206\u5f00&#xff0c;\u7f16\u8bd1\u5668\u524d\u7aef\u53ef\u4ee5\u590d\u7528&#xff0c;\u53ea\u9700\u8981\u4e3a\u4e0d\u540c\u67b6\u6784\u5199\u4e0d\u540c\u7684\u6c47\u7f16\u5668\u3002<\/p>\n<p>3. \u94fe\u63a5\u72ec\u7acb\u7684\u539f\u56e0 \u8fd9\u662f\u6700\u91cd\u8981\u7684\u4e00\u70b9\u3002\u94fe\u63a5\u5668\u7684\u5b58\u5728\u4f7f\u5f97\u591a\u6587\u4ef6\u7f16\u8bd1\u6210\u4e3a\u53ef\u80fd&#xff1a;\u4f60\u53ef\u4ee5\u628a\u4e00\u4e2a\u5927\u9879\u76ee\u62c6\u6210\u591a\u4e2a .c \u6587\u4ef6&#xff0c;\u5206\u522b\u7f16\u8bd1\u6210 .o&#xff0c;\u6700\u540e\u518d\u94fe\u63a5\u5230\u4e00\u8d77\u3002\u4fee\u6539\u4e00\u4e2a\u6587\u4ef6\u53ea\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u90a3\u4e00\u4e2a\u6587\u4ef6&#xff0c;\u4e0d\u7528\u91cd\u65b0\u7f16\u8bd1\u6574\u4e2a\u9879\u76ee\u3002\u8fd9\u5c31\u662f&#034;\u5206\u79bb\u7f16\u8bd1&#034;&#xff08;separate compilation&#xff09;\u6a21\u578b\u3002<\/p>\n<p>\u66f4\u6df1\u5c42\u5730\u8bf4&#xff0c;\u94fe\u63a5\u5668\u8fd8\u8d1f\u8d23\u5e93\u7684\u94fe\u63a5\u2014\u2014\u9759\u6001\u94fe\u63a5\u628a\u5e93\u4ee3\u7801\u76f4\u63a5\u62f7\u8fdb\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u52a8\u6001\u94fe\u63a5\u5219\u5728\u8fd0\u884c\u65f6\u52a0\u8f7d\u3002\u5982\u679c\u6ca1\u6709\u72ec\u7acb\u7684\u94fe\u63a5\u9636\u6bb5&#xff0c;\u8fd9\u4e9b\u673a\u5236\u90fd\u65e0\u6cd5\u5b9e\u73b0\u3002<\/p>\n<p>&#x1f4d6; \u56db\u9636\u6bb5\u7f16\u8bd1\u6a21\u578b\u662f\u8f6f\u4ef6\u5de5\u7a0b\u4e2d&#034;\u5206\u5c42\u4e0e\u5206\u79bb&#034;\u601d\u60f3\u7684\u5178\u578b\u4f53\u73b0&#xff1a;\u6bcf\u5c42\u53ea\u8d1f\u8d23\u4e00\u4ef6\u4e8b&#xff0c;\u5c42\u95f4\u901a\u8fc7\u7a33\u5b9a\u7684\u4e2d\u95f4\u683c\u5f0f&#xff08;\u9884\u5904\u7406\u4ee3\u7801\u3001\u6c47\u7f16\u4ee3\u7801\u3001\u76ee\u6807\u6587\u4ef6&#xff09;\u89e3\u8026\u3002\u8fd9\u4e0d\u4ec5\u662f\u6280\u672f\u5b9e\u73b0&#xff0c;\u66f4\u662f\u4e00\u79cd\u8bbe\u8ba1\u54f2\u5b66\u2014\u2014\u590d\u6742\u7cfb\u7edf\u7684\u6784\u5efa&#xff0c;\u672c\u8d28\u5c31\u662f\u5408\u7406\u62c6\u5206\u548c\u63a5\u53e3\u8bbe\u8ba1\u3002<\/p>\n<hr \/>\n<h2>\u4e09\u3001\u6574\u6570&#xff1a;\u4ece\u539f\u7801\u53cd\u7801\u5230\u8865\u7801&#xff0c;\u4e00\u6b21\u8bf4\u6e05\u695a<\/h2>\n<p>\u7b2c\u4e09\u7ae0\u5f00\u59cb\u8bb2\u6570\u636e\u7c7b\u578b&#xff0c;\u7b2c\u4e00\u4e2a\u91cd\u70b9\u5c31\u662f\u6574\u6570\u7c7b\u578b\u3002<\/p>\n<p>\u4e66\u91cc\u5217\u51fa\u4e86 int\u3001short\u3001long\u3001long long&#xff0c;\u4ee5\u53ca\u5b83\u4eec\u7684 unsigned \u7248\u672c&#xff0c;\u4f46\u53ea\u662f\u4ecb\u7ecd\u4e86\u7528\u6cd5\u3002\u6211\u60f3\u6df1\u5165\u63a2\u8ba8\u4e00\u4e2a\u95ee\u9898&#xff1a;\u6574\u6570\u5728\u5185\u5b58\u91cc\u5230\u5e95\u662f\u600e\u4e48\u5b58\u7684&#xff1f;\u4e3a\u4ec0\u4e48\u8981\u8fd9\u4e48\u5b58&#xff1f;<\/p>\n<h3>3.1 \u539f\u7801\u3001\u53cd\u7801\u3001\u8865\u7801&#xff1a;\u4e09\u5144\u5f1f\u7684\u6545\u4e8b<\/h3>\n<p>\u4e3a\u4e86\u8868\u793a\u8d1f\u6570&#xff0c;\u8ba1\u7b97\u673a\u79d1\u5b66\u5bb6\u4eec\u60f3\u8fc7\u597d\u51e0\u79cd\u65b9\u6848&#xff1a;<\/p>\n<p>\u539f\u7801&#xff08;Sign-Magnitude&#xff09;&#xff1a;\u6700\u9ad8\u4f4d\u662f\u7b26\u53f7\u4f4d&#xff0c;0 \u8868\u793a\u6b63&#xff0c;1 \u8868\u793a\u8d1f&#xff0c;\u5176\u4f59\u4f4d\u662f\u7edd\u5bf9\u503c\u3002<\/p>\n<p>&#043;5 &#061; 0000 0101<br \/>\n-5 &#061; 1000 0101<\/p>\n<p>\u539f\u7801\u7684\u95ee\u9898&#xff1a;&#043;0 \u548c -0 \u4e0d\u7edf\u4e00&#xff08;00000000 \u548c 10000000&#xff09;&#xff0c;\u6d6a\u8d39\u4e86\u4e00\u4e2a\u7f16\u7801\u3002\u800c\u4e14\u505a\u52a0\u51cf\u6cd5\u8981\u5355\u72ec\u5904\u7406\u7b26\u53f7\u4f4d&#xff0c;\u7535\u8def\u8bbe\u8ba1\u590d\u6742\u3002<\/p>\n<p>\u53cd\u7801&#xff08;One\u2019s Complement&#xff09;&#xff1a;\u6b63\u6570\u7684\u53cd\u7801\u7b49\u4e8e\u539f\u7801&#xff0c;\u8d1f\u6570\u7684\u53cd\u7801\u662f\u7b26\u53f7\u4f4d\u4e0d\u53d8&#xff0c;\u5176\u4f59\u4f4d\u53d6\u53cd\u3002<\/p>\n<p>&#043;5 &#061; 0000 0101<br \/>\n-5 &#061; 1111 1010<\/p>\n<p>\u53cd\u7801\u7684\u95ee\u9898&#xff1a;\u8fd8\u662f\u6709 &#043;0 \u548c -0 \u4e24\u4e2a\u96f6&#xff0c;\u800c\u4e14\u52a0\u6cd5\u9700\u8981\u5904\u7406&#034;\u5faa\u73af\u8fdb\u4f4d&#034;&#xff0c;\u8fd8\u662f\u4e0d\u591f\u4f18\u96c5\u3002<\/p>\n<p>\u8865\u7801&#xff08;Two\u2019s Complement&#xff09;&#xff1a;\u6b63\u6570\u7684\u8865\u7801\u7b49\u4e8e\u539f\u7801&#xff0c;\u8d1f\u6570\u7684\u8865\u7801\u662f\u5176\u53cd\u7801\u52a0 1\u3002<\/p>\n<p>&#043;5 &#061; 0000 0101<br \/>\n-5 &#061; 1111 1011  &#xff08;\u53cd\u7801 11111010 &#043; 1 &#061; 11111011&#xff09;<\/p>\n<p>\u8865\u7801\u7684\u4f18\u52bf\u5de8\u5927&#xff1a;<\/p>\n<ul>\n<li>\u96f6\u7684\u8868\u793a\u552f\u4e00&#xff08;00000000&#xff09;<\/li>\n<li>\u52a0\u51cf\u6cd5\u53ef\u4ee5\u7528\u540c\u4e00\u5957\u7535\u8def&#xff1a;\u51cf\u53bb\u4e00\u4e2a\u6570\u7b49\u4e8e\u52a0\u4e0a\u5b83\u7684\u8865\u7801<\/li>\n<li>\u7b26\u53f7\u4f4d\u81ea\u7136\u53c2\u4e0e\u8fd0\u7b97&#xff0c;\u4e0d\u9700\u8981\u7279\u6b8a\u5904\u7406<\/li>\n<\/ul>\n<p>\u6240\u4ee5\u73b0\u4ee3\u8ba1\u7b97\u673a\u65e0\u4e00\u4f8b\u5916\u90fd\u91c7\u7528\u8865\u7801\u6765\u5b58\u50a8\u6709\u7b26\u53f7\u6574\u6570\u3002<\/p>\n<h3>3.2 \u8865\u7801\u7684\u6570\u5b66\u672c\u8d28<\/h3>\n<p>\u8865\u7801\u7684\u601d\u60f3\u5176\u5b9e\u6765\u81ea\u4e8e&#034;\u6a21\u8fd0\u7b97&#034;\u3002\u60f3\u8c61\u4e00\u4e2a 8 \u4f4d\u7684\u8ba1\u6570\u5668&#xff0c;\u5b83\u7684\u6a21\u5c31\u662f 2^8 &#061; 256\u3002\u5f53\u8ba1\u6570\u5230 255 \u518d\u52a0 1&#xff0c;\u5c31\u4f1a\u6ea2\u51fa\u56de\u5230 0\u2014\u2014\u8fd9\u548c\u949f\u8868\u7684 12 \u8fdb\u5236\u662f\u4e00\u6837\u7684\u3002<\/p>\n<p>\u5728\u6a21 256 \u7684\u4f53\u7cfb\u91cc&#xff1a;<\/p>\n<ul>\n<li>5 &#8211; 3 \u7b49\u4ef7\u4e8e 5 &#043; (256 &#8211; 3) &#061; 5 &#043; 253 &#061; 258 \u2261 2 (mod 256)<\/li>\n<li>253 \u7684\u4e8c\u8fdb\u5236\u5c31\u662f 1111 1101&#xff0c;\u8fd9\u6070\u597d\u5c31\u662f -3 \u7684 8 \u4f4d\u8865\u7801\u8868\u793a&#xff01;<\/li>\n<\/ul>\n<p>\u6240\u4ee5\u8d1f\u6570\u7684\u8865\u7801&#xff0c;\u672c\u8d28\u4e0a\u5c31\u662f\u5728\u6a21 2^n \u4e0b\u8fd9\u4e2a\u6570\u7684\u6b63\u540c\u4f59\u6570\u3002<\/p>\n<p>-n \u2261 2^n &#8211; n   (mod 2^n)<\/p>\n<p>\u8fd9\u4e2a\u6570\u5b66\u6027\u8d28\u592a\u91cd\u8981\u4e86&#xff0c;\u5b83\u610f\u5473\u7740&#xff1a;\u7528\u8865\u7801\u8868\u793a\u7684\u6709\u7b26\u53f7\u6574\u6570&#xff0c;\u6240\u6709\u7684\u52a0\u51cf\u6cd5\u8fd0\u7b97\u90fd\u53ef\u4ee5\u76f4\u63a5\u5f53\u65e0\u7b26\u53f7\u6570\u6765\u7b97&#xff0c;\u7ed3\u679c\u81ea\u52a8\u5c31\u662f\u5bf9\u7684\u3002CPU \u6839\u672c\u4e0d\u9700\u8981\u77e5\u9053\u4f60\u628a\u5b83\u5f53\u6709\u7b26\u53f7\u8fd8\u662f\u65e0\u7b26\u53f7&#xff0c;\u7535\u8def\u662f\u540c\u4e00\u5957\u2014\u2014\u53ea\u6709\u5728\u5224\u65ad\u5927\u5c0f\u3001\u8f93\u51fa\u6253\u5370\u7684\u65f6\u5019&#xff0c;\u624d\u9700\u8981\u533a\u5206\u89e3\u91ca\u65b9\u5f0f\u3002<\/p>\n<h3>3.3 \u6574\u6570\u6ea2\u51fa&#xff1a;\u672a\u5b9a\u4e49\u884c\u4e3a<\/h3>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;limits.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> max <span class=\"token operator\">&#061;<\/span> INT_MAX<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;INT_MAX &#061; %d\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> max<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;INT_MAX &#043; 1 &#061; %d\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> max <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u4f1a\u53d1\u751f\u4ec0\u4e48&#xff1f;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4f60\u53ef\u80fd\u4f1a\u8bf4&#xff1a;\u201c\u8fd9\u8fd8\u4e0d\u7b80\u5355&#xff0c;\u6ea2\u51fa\u4e86\u5457&#xff0c;\u53d8\u6210 INT_MIN \u4e86\u3002\u201d<\/p>\n<p>\u4f46\u6211\u8981\u63d0\u9192\u4f60&#xff1a;\u6709\u7b26\u53f7\u6574\u6570\u6ea2\u51fa\u5728 C \u6807\u51c6\u4e2d\u662f&#034;\u672a\u5b9a\u4e49\u884c\u4e3a&#034;&#xff08;Undefined Behavior, UB&#xff09;\u3002<\/p>\n<p>\u4ec0\u4e48\u610f\u601d&#xff1f;\u5c31\u662f C \u6807\u51c6\u6ca1\u6709\u89c4\u5b9a\u6ea2\u51fa\u540e\u4f1a\u53d1\u751f\u4ec0\u4e48\u3002\u4f60\u5728 x86 &#043; GCC \u4e0a\u53ef\u80fd\u770b\u5230&#034;\u56de\u7ed5&#034;\u6210\u8d1f\u6570&#xff0c;\u4f46\u6362\u5230\u53e6\u4e00\u4e2a\u7f16\u8bd1\u5668\u6216\u53e6\u4e00\u4e2a\u5e73\u53f0&#xff0c;\u7ed3\u679c\u5b8c\u5168\u4e0d\u53ef\u9884\u6d4b\u2014\u2014\u7f16\u8bd1\u5668\u751a\u81f3\u53ef\u4ee5\u76f4\u63a5\u628a\u6574\u4e2a\u7a0b\u5e8f\u4f18\u5316\u6389\u3002<\/p>\n<p>\u8fd9\u662f\u521d\u5b66\u8005\u6700\u5bb9\u6613\u8e29\u7684\u5751\u4e4b\u4e00&#xff1a;\u4e0d\u8981\u4f9d\u8d56\u6709\u7b26\u53f7\u6574\u6570\u6ea2\u51fa\u7684&#034;\u56de\u7ed5&#034;\u884c\u4e3a\u3002\u5982\u679c\u9700\u8981\u786e\u5b9a\u7684\u56de\u7ed5\u8bed\u4e49&#xff0c;\u8bf7\u7528 unsigned \u7c7b\u578b\u2014\u2014\u65e0\u7b26\u53f7\u6574\u6570\u7684\u6ea2\u51fa\u662f\u6709\u660e\u786e\u5b9a\u4e49\u7684&#xff08;\u6a21 2^n&#xff09;\u3002<\/p>\n<hr \/>\n<h3>\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48\u6709\u7b26\u53f7\u6ea2\u51fa\u662f UB&#xff0c;\u65e0\u7b26\u53f7\u6ea2\u51fa\u5374\u5b9a\u4e49\u660e\u786e&#xff1f;<\/h3>\n<p>\u95ee&#xff1a;\u540c\u6837\u662f\u6ea2\u51fa&#xff0c;\u4e3a\u4ec0\u4e48 C \u6807\u51c6\u5bf9\u6709\u7b26\u53f7\u548c\u65e0\u7b26\u53f7\u6574\u6570\u533a\u522b\u5bf9\u5f85&#xff1f;\u8fd9\u4e0d\u662f\u53cc\u91cd\u6807\u51c6\u5417&#xff1f;<\/p>\n<p>\u7b54&#xff1a;\u8fd9\u4e0d\u662f\u53cc\u91cd\u6807\u51c6&#xff0c;\u800c\u662f\u5386\u53f2\u539f\u56e0\u548c\u4f18\u5316\u7a7a\u95f4\u7684\u6743\u8861\u3002<\/p>\n<p>\u5386\u53f2\u539f\u56e0&#xff1a;C \u8bed\u8a00\u8bbe\u8ba1\u7684\u5e74\u4ee3&#xff0c;\u5e76\u4e0d\u662f\u6240\u6709\u8ba1\u7b97\u673a\u90fd\u7528\u8865\u7801\u3002\u6709\u4e9b\u673a\u5668\u7528\u53cd\u7801&#xff08;\u6bd4\u5982 CDC 6000 \u7cfb\u5217&#xff09;&#xff0c;\u6709\u4e9b\u7528\u539f\u7801&#xff08;\u6bd4\u5982\u65e9\u671f\u7684 IBM \u5927\u578b\u673a&#xff09;\u3002\u5982\u679c C \u6807\u51c6\u5f3a\u884c\u89c4\u5b9a\u6709\u7b26\u53f7\u6ea2\u51fa\u7684\u884c\u4e3a&#xff0c;\u90a3\u5728\u975e\u8865\u7801\u673a\u5668\u4e0a\u5b9e\u73b0\u8d77\u6765\u5c31\u4f1a\u6709\u989d\u5916\u5f00\u9500&#xff0c;\u8fdd\u80cc\u4e86 C \u8bed\u8a00&#034;\u4e0d\u4e3a\u4f60\u4e0d\u7528\u7684\u4e1c\u897f\u4ed8\u51fa\u4ee3\u4ef7&#034;\u7684\u539f\u5219\u3002<\/p>\n<p>\u4f18\u5316\u539f\u56e0&#xff1a;\u628a\u6709\u7b26\u53f7\u6ea2\u51fa\u5b9a\u4e49\u4e3a UB&#xff0c;\u7ed9\u4e86\u7f16\u8bd1\u5668\u5f88\u5927\u7684\u4f18\u5316\u7a7a\u95f4\u3002\u6bd4\u5982&#xff1a;<\/p>\n<p><span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5faa\u73af\u4f53<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5982\u679c\u6709\u7b26\u53f7\u6ea2\u51fa\u662f UB&#xff0c;\u7f16\u8bd1\u5668\u5c31\u53ef\u4ee5\u5047\u8bbe i \u6c38\u8fdc\u4e0d\u4f1a\u6ea2\u51fa\u53d8\u6210\u8d1f\u6570&#xff08;\u56e0\u4e3a\u6ea2\u51fa\u662f UB&#xff0c;\u7a0b\u5e8f\u5458\u6709\u4e49\u52a1\u4fdd\u8bc1\u4e0d\u53d1\u751f&#xff09;&#xff0c;\u4ece\u800c\u63a8\u65ad\u51fa\u8fd9\u4e2a\u5faa\u73af\u662f\u6b7b\u5faa\u73af&#xff0c;\u53ef\u4ee5\u505a\u76f8\u5e94\u7684\u4f18\u5316\u3002\u5982\u679c\u6ea2\u51fa\u6709\u660e\u786e\u5b9a\u4e49&#xff08;\u56de\u7ed5&#xff09;&#xff0c;\u7f16\u8bd1\u5668\u5c31\u4e0d\u80fd\u505a\u8fd9\u4e2a\u5047\u8bbe\u4e86\u3002<\/p>\n<p>\u518d\u4e3e\u4e00\u4e2a\u4f8b\u5b50&#xff1a;<\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">foo<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> x<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> x <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">1<\/span> <span class=\"token operator\">&gt;<\/span> x<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u8fd9\u4e2a\u603b\u662f\u771f\u7684\u5417&#xff1f;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5982\u679c\u6709\u7b26\u53f7\u6ea2\u51fa\u662f UB&#xff0c;\u7f16\u8bd1\u5668\u5c31\u53ef\u4ee5\u76f4\u63a5\u628a\u6574\u4e2a\u51fd\u6570\u4f18\u5316\u4e3a return 1;&#xff0c;\u56e0\u4e3a x &#043; 1 &gt; x \u5728\u4e0d\u6ea2\u51fa\u7684\u60c5\u51b5\u4e0b\u6052\u771f&#xff0c;\u800c\u6ea2\u51fa\u662f UB \u4e0d\u7528\u8003\u8651\u3002<\/p>\n<p>\u65e0\u7b26\u53f7\u6574\u6570\u5c31\u4e0d\u4e00\u6837\u4e86\u2014\u2014\u6807\u51c6\u660e\u786e\u89c4\u5b9a\u65e0\u7b26\u53f7\u7b97\u672f\u662f\u6a21 2^n \u7684&#xff0c;\u6240\u4ee5\u7f16\u8bd1\u5668\u4e0d\u80fd\u505a\u8fd9\u79cd\u5047\u8bbe&#xff0c;\u5fc5\u987b\u8001\u8001\u5b9e\u5b9e\u751f\u6210\u52a0\u6cd5\u6307\u4ee4\u3002<\/p>\n<p>&#x1f4d6; \u672a\u5b9a\u4e49\u884c\u4e3a\u662f C \u8bed\u8a00\u8bbe\u8ba1\u54f2\u5b66\u7684\u6838\u5fc3\u4f53\u73b0&#xff1a;\u4fe1\u4efb\u7a0b\u5e8f\u5458&#xff0c;\u628a\u6b63\u786e\u6027\u7684\u8d23\u4efb\u4ea4\u7ed9\u7a0b\u5e8f\u5458&#xff0c;\u6362\u53d6\u6700\u5927\u7684\u4f18\u5316\u7a7a\u95f4\u3002\u7406\u89e3 UB \u662f\u4ece&#034;\u4f1a\u5199 C \u4ee3\u7801&#034;\u5230&#034;\u61c2 C \u8bed\u8a00&#034;\u7684\u5fc5\u7ecf\u4e4b\u8def\u2014\u2014\u4f60\u4e0d\u4ec5\u8981\u77e5\u9053&#034;\u4ee3\u7801\u8be5\u600e\u4e48\u5199&#034;&#xff0c;\u8fd8\u8981\u77e5\u9053&#034;\u54ea\u4e9b\u5199\u6cd5\u662f\u6807\u51c6\u4e0d\u4fdd\u8bc1\u7684&#034;\u3002<\/p>\n<hr \/>\n<h2>\u56db\u3001\u6d6e\u70b9\u6570&#xff1a;IEEE 754 \u6807\u51c6\u7684\u7cbe\u5999\u4e0e\u9677\u9631<\/h2>\n<p>\u7b2c\u4e09\u7ae0\u53e6\u4e00\u4e2a\u91cd\u70b9\u662f\u6d6e\u70b9\u6570\u7c7b\u578b&#xff1a;float\u3001double\u3001long double\u3002<\/p>\n<p>\u5f88\u591a\u4eba\u90fd\u542c\u8fc7&#034;\u6d6e\u70b9\u6570\u4e0d\u7cbe\u786e&#034;&#xff0c;\u4f46\u4e3a\u4ec0\u4e48\u4e0d\u7cbe\u786e&#xff1f;\u8bef\u5dee\u5230\u5e95\u6709\u591a\u5927&#xff1f;\u8fd9\u80cc\u540e\u7684 IEEE 754 \u6807\u51c6\u5230\u5e95\u662f\u600e\u4e48\u56de\u4e8b&#xff1f;\u6211\u6765\u597d\u597d\u62c6\u89e3\u4e00\u4e0b\u3002<\/p>\n<h3>4.1 \u79d1\u5b66\u8ba1\u6570\u6cd5&#xff1a;\u6d6e\u70b9\u6570\u7684\u57fa\u672c\u601d\u60f3<\/h3>\n<p>\u6d6e\u70b9\u6570\u7684\u6838\u5fc3\u601d\u60f3\u662f\u79d1\u5b66\u8ba1\u6570\u6cd5\u3002\u6bd4\u5982 123.45 \u53ef\u4ee5\u5199\u6210&#xff1a;<\/p>\n<p>1.2345 \u00d7 10^2<\/p>\n<p>\u4e09\u90e8\u5206\u7ec4\u6210&#xff1a;\u5c3e\u6570&#xff08;significand\/mantissa&#xff09; 1.2345\u3001\u57fa\u6570&#xff08;base&#xff09; 10\u3001\u6307\u6570&#xff08;exponent&#xff09; 2\u3002<\/p>\n<p>\u8ba1\u7b97\u673a\u7528\u4e8c\u8fdb\u5236&#xff0c;\u6240\u4ee5 IEEE 754 \u6d6e\u70b9\u6570\u7528\u7684\u662f\u4e8c\u8fdb\u5236\u79d1\u5b66\u8ba1\u6570\u6cd5&#xff1a;<\/p>\n<p>(-1)^s \u00d7 m \u00d7 2^e<\/p>\n<ul>\n<li>s&#xff1a;\u7b26\u53f7\u4f4d&#xff0c;0 \u6b63 1 \u8d1f<\/li>\n<li>m&#xff1a;\u5c3e\u6570&#xff08;\u6709\u6548\u6570\u5b57&#xff09;&#xff0c;1 \u2264 m &lt; 2<\/li>\n<li>e&#xff1a;\u6307\u6570<\/li>\n<\/ul>\n<h3>4.2 IEEE 754 \u5355\u7cbe\u5ea6&#xff08;float&#xff09;\u7684\u5185\u5b58\u5e03\u5c40<\/h3>\n<p>\u4e00\u4e2a 32 \u4f4d\u7684 float \u5728\u5185\u5b58\u4e2d\u662f\u8fd9\u6837\u5206\u5e03\u7684&#xff1a;<\/p>\n<p>  1\u4f4d      8\u4f4d        23\u4f4d<br \/>\n&#043;&#8212;&#043;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;<br \/>\n| s |  \u6307\u6570 e  |        \u5c3e\u6570 m         |<br \/>\n&#043;&#8212;&#043;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;<br \/>\n 31  30       23 22                    0<\/p>\n<p>\u4f46\u6709\u4e24\u4e2a\u7cbe\u5999\u7684\u8bbe\u8ba1&#xff1a;<\/p>\n<p>1. \u5c3e\u6570\u7684&#034;\u9690\u542b 1&#034;<\/p>\n<p>\u56e0\u4e3a\u5c3e\u6570 m \u603b\u662f\u6ee1\u8db3 1 \u2264 m &lt; 2&#xff08;\u8fd9\u53eb&#034;\u89c4\u683c\u5316\u6570&#034;&#xff09;&#xff0c;\u6240\u4ee5\u6574\u6570\u90e8\u5206\u90a3\u4e2a 1 \u662f\u56fa\u5b9a\u7684&#xff0c;\u53ef\u4ee5\u4e0d\u5b58&#xff01;23 \u4f4d\u53ea\u5b58\u5c0f\u6570\u90e8\u5206&#xff0c;\u76f8\u5f53\u4e8e\u514d\u8d39\u591a\u4e86 1 \u4f4d\u7cbe\u5ea6\u3002\u6240\u4ee5 float \u7684\u6709\u6548\u6570\u5b57\u5b9e\u9645\u4e0a\u662f 24 \u4f4d&#xff08;\u5927\u7ea6 7 \u4f4d\u5341\u8fdb\u5236\u6570\u5b57&#xff09;\u3002<\/p>\n<p>2. \u6307\u6570\u7684&#034;\u504f\u7f6e&#034;\u8868\u793a<\/p>\n<p>\u6307\u6570\u53ef\u4ee5\u662f\u6b63\u6570\u4e5f\u53ef\u4ee5\u662f\u8d1f\u6570&#xff0c;\u4f46\u5982\u679c\u7528\u8865\u7801\u5b58&#xff0c;\u6bd4\u8f83\u5927\u5c0f\u4f1a\u6bd4\u8f83\u9ebb\u70e6\u3002IEEE 754 \u91c7\u7528\u4e86**\u504f\u7f6e\u6307\u6570&#xff08;biased exponent&#xff09;**\u7684\u65b9\u6848&#xff1a;<\/p>\n<ul>\n<li>\u5355\u7cbe\u5ea6\u504f\u7f6e\u503c&#xff1a;127<\/li>\n<li>\u5b58\u50a8\u7684\u6307\u6570\u503c &#061; \u771f\u5b9e\u6307\u6570 &#043; 127<\/li>\n<\/ul>\n<p>\u6bd4\u5982\u771f\u5b9e\u6307\u6570\u662f -3&#xff0c;\u5c31\u5b58\u6210 124&#xff08;01111100&#xff09;&#xff1b;\u771f\u5b9e\u6307\u6570\u662f 5&#xff0c;\u5c31\u5b58\u6210 132&#xff08;10000100&#xff09;\u3002<\/p>\n<p>\u8fd9\u6837\u505a\u7684\u597d\u5904\u662f&#xff1a;\u6d6e\u70b9\u6570\u7684\u5927\u5c0f\u6bd4\u8f83\u53ef\u4ee5\u76f4\u63a5\u7528\u6574\u6570\u6bd4\u8f83\u7684\u65b9\u5f0f\u6765\u505a\u2014\u2014\u628a\u4e24\u4e2a float \u7684\u4f4d\u6a21\u5f0f\u5f53\u4f5c\u65e0\u7b26\u53f7\u6574\u6570\u6bd4\u5927\u5c0f&#xff0c;\u7ed3\u679c\u548c\u6d6e\u70b9\u6570\u672c\u8eab\u7684\u5927\u5c0f\u5173\u7cfb\u662f\u4e00\u81f4\u7684&#xff08;\u540c\u53f7\u65f6&#xff09;\u3002\u8fd9\u4e2a\u8bbe\u8ba1\u8ba9\u786c\u4ef6\u5b9e\u73b0\u6d6e\u70b9\u6570\u6bd4\u8f83\u53d8\u5f97\u975e\u5e38\u7b80\u5355\u3002<\/p>\n<h3>4.3 \u4e3a\u4ec0\u4e48 0.1 &#043; 0.2 \u2260 0.3&#xff1f;<\/h3>\n<p>\u7ecf\u5178\u95ee\u9898&#xff0c;\u76f4\u63a5\u4e0a\u7b54\u6848&#xff1a;\u56e0\u4e3a 0.1 \u5728\u4e8c\u8fdb\u5236\u4e2d\u662f\u65e0\u9650\u5faa\u73af\u5c0f\u6570\u3002<\/p>\n<p>\u5c31\u50cf 1\/3 \u5728\u5341\u8fdb\u5236\u91cc\u662f 0.3333\u2026 \u5199\u4e0d\u5b8c\u4e00\u6837&#xff0c;0.1 \u8f6c\u6362\u6210\u4e8c\u8fdb\u5236&#xff1a;<\/p>\n<p>0.1 \u00d7 2 &#061; 0.2 \u2192 0<br \/>\n0.2 \u00d7 2 &#061; 0.4 \u2192 0<br \/>\n0.4 \u00d7 2 &#061; 0.8 \u2192 0<br \/>\n0.8 \u00d7 2 &#061; 1.6 \u2192 1<br \/>\n0.6 \u00d7 2 &#061; 1.2 \u2192 1<br \/>\n0.2 \u00d7 2 &#061; 0.4 \u2192 0  \u2190 \u5f00\u59cb\u5faa\u73af\u4e86<br \/>\n&#8230;<\/p>\n<p>\u6240\u4ee5 0.1 \u7684\u4e8c\u8fdb\u5236\u662f 0.0001100110011\u2026&#xff08;0011 \u5faa\u73af&#xff09;&#xff0c;\u6c38\u8fdc\u5199\u4e0d\u5b8c\u3002float \u53ea\u6709 23 \u4f4d\u5c3e\u6570\u4f4d&#xff0c;\u53ea\u80fd\u622a\u65ad\u5b58\u50a8&#xff0c;\u5fc5\u7136\u6709\u8bef\u5dee\u3002<\/p>\n<p>\u9a8c\u8bc1\u4e00\u4e0b&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">float<\/span> a <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0.1f<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">float<\/span> b <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0.2f<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;0.1 &#043; 0.2 &#061; %.10f\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> a <span class=\"token operator\">&#043;<\/span> b<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;0.3       &#061; %.10f\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">0.3f<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8f93\u51fa\u5927\u6982\u662f&#xff1a;<\/p>\n<p>0.1 &#043; 0.2 &#061; 0.3000000119<br \/>\n0.3       &#061; 0.3000000119<\/p>\n<p>\u7b49\u7b49&#xff0c;\u4e24\u4e2a\u8f93\u51fa\u4e00\u6837&#xff1f;\u90a3 a &#043; b &#061;&#061; 0.3f \u5e94\u8be5\u662f true \u5427&#xff1f;\u4e0d\u4e00\u5b9a\u2014\u2014\u8fd9\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u8ba1\u7b97\u7cbe\u5ea6\u548c\u7f16\u8bd1\u5668\u4f18\u5316\u3002\u5728 x86 \u4e0a&#xff0c;a &#043; b \u53ef\u80fd\u5148\u7528 80 \u4f4d\u6269\u5c55\u7cbe\u5ea6\u8ba1\u7b97&#xff0c;\u518d\u5b58\u56de float&#xff0c;\u4e2d\u95f4\u7684\u820d\u5165\u8bef\u5dee\u53ef\u80fd\u5bfc\u81f4\u7ed3\u679c\u548c\u76f4\u63a5\u5199\u7684 0.3f \u4e0d\u4e00\u6837\u3002<\/p>\n<p>\u7ed3\u8bba&#xff1a;\u6c38\u8fdc\u4e0d\u8981\u7528 &#061;&#061; \u6bd4\u8f83\u6d6e\u70b9\u6570\u662f\u5426\u76f8\u7b49\u3002\u5e94\u8be5\u7528&#034;\u5dee\u503c\u662f\u5426\u5728\u53ef\u63a5\u53d7\u8303\u56f4\u5185&#034;\u6765\u5224\u65ad&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;math.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">is_equal<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">float<\/span> a<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">float<\/span> b<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">float<\/span> epsilon<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token function\">fabs<\/span><span class=\"token punctuation\">(<\/span>a <span class=\"token operator\">&#8211;<\/span> b<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&lt;<\/span> epsilon<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>4.4 \u7279\u6b8a\u503c&#xff1a;\u65e0\u7a77\u5927\u3001NaN\u3001\u975e\u89c4\u683c\u5316\u6570<\/h3>\n<p>IEEE 754 \u8fd8\u5b9a\u4e49\u4e86\u4e00\u4e9b\u7279\u6b8a\u503c&#xff0c;\u5b83\u4eec\u7528\u5168 0 \u6216\u5168 1 \u7684\u6307\u6570\u6765\u8868\u793a&#xff1a;<\/p>\n<table>\n<tr>\u6307\u6570\u5c3e\u6570\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>\u5168 0<\/td>\n<td>\u5168 0<\/td>\n<td>\u00b10<\/td>\n<\/tr>\n<tr>\n<td>\u5168 0<\/td>\n<td>\u975e 0<\/td>\n<td>\u975e\u89c4\u683c\u5316\u6570&#xff08;denormal&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5168 1<\/td>\n<td>\u5168 0<\/td>\n<td>\u00b1\u221e<\/td>\n<\/tr>\n<tr>\n<td>\u5168 1<\/td>\n<td>\u975e 0<\/td>\n<td>NaN&#xff08;Not a Number&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u975e\u89c4\u683c\u5316\u6570\u5f88\u6709\u610f\u601d\u2014\u2014\u5f53\u6307\u6570\u5168 0\u3001\u5c3e\u6570\u975e 0 \u65f6&#xff0c;\u5c3e\u6570\u7684\u9690\u542b\u6574\u6570\u90e8\u5206\u4e0d\u662f 1 \u800c\u662f 0&#xff0c;\u6307\u6570\u7684\u503c\u662f -126&#xff08;\u800c\u4e0d\u662f -127&#xff09;\u3002\u8fd9\u4f7f\u5f97\u6d6e\u70b9\u6570\u53ef\u4ee5\u8868\u793a\u6bd4\u89c4\u683c\u5316\u7684\u6700\u5c0f\u503c\u8fd8\u5c0f\u7684\u6570&#xff0c;\u5b9e\u73b0\u4e86&#034;\u9010\u7ea7\u4e0b\u6ea2&#034;&#xff08;gradual underflow&#xff09;&#xff0c;\u907f\u514d\u4e86\u4e24\u4e2a\u5f88\u5c0f\u7684\u6570\u76f8\u51cf\u76f4\u63a5\u53d8\u6210 0 \u7684\u7cbe\u5ea6\u635f\u5931\u3002<\/p>\n<p>NaN \u4e5f\u5f88\u7279\u522b&#xff1a;\u4efb\u4f55\u6d89\u53ca NaN \u7684\u8fd0\u7b97\u7ed3\u679c\u90fd\u662f NaN&#xff0c;\u800c\u4e14 NaN !&#061; NaN&#xff08;\u81ea\u5df1\u548c\u81ea\u5df1\u90fd\u4e0d\u76f8\u7b49&#xff09;\u3002\u5224\u65ad\u4e00\u4e2a\u503c\u662f\u4e0d\u662f NaN&#xff0c;\u8981\u7528 isnan() \u51fd\u6570&#xff0c;\u4e0d\u80fd\u7528 x &#061;&#061; x \u7684\u6280\u5de7&#xff08;\u867d\u7136\u5728\u5f88\u591a\u5e73\u53f0\u4e0a\u8fd9\u4e5f\u884c&#xff0c;\u4f46\u4e0d\u89c4\u8303&#xff09;\u3002<\/p>\n<hr \/>\n<h3>\u6df1\u5ea6\u601d\u8003&#xff1a;float \u548c double \u7684\u7cbe\u5ea6\u5230\u5e95\u5dee\u591a\u5c11&#xff1f;<\/h3>\n<p>\u95ee&#xff1a;float \u662f 32 \u4f4d&#xff0c;double \u662f 64 \u4f4d&#xff0c;\u7cbe\u5ea6\u5dee\u4e86\u4e00\u500d\u5417&#xff1f;\u5b9e\u9645\u4f7f\u7528\u4e2d\u4ec0\u4e48\u65f6\u5019\u8be5\u7528 float&#xff0c;\u4ec0\u4e48\u65f6\u5019\u8be5\u7528 double&#xff1f;<\/p>\n<p>\u7b54&#xff1a;\u5148\u770b\u4e24\u8005\u7684\u53c2\u6570\u5bf9\u6bd4&#xff1a;<\/p>\n<table>\n<tr>\u7c7b\u578b\u603b\u4f4d\u6570\u7b26\u53f7\u4f4d\u6307\u6570\u4f4d\u5c3e\u6570\u4f4d\u6709\u6548\u4f4d\u6570&#xff08;\u5341\u8fdb\u5236&#xff09;\u6307\u6570\u8303\u56f4<\/tr>\n<tbody>\n<tr>\n<td>float<\/td>\n<td>32<\/td>\n<td>1<\/td>\n<td>8<\/td>\n<td>23&#xff08;&#043;1\u9690\u542b&#xff09;<\/td>\n<td>\u7ea6 7 \u4f4d<\/td>\n<td>-126 ~ &#043;127<\/td>\n<\/tr>\n<tr>\n<td>double<\/td>\n<td>64<\/td>\n<td>1<\/td>\n<td>11<\/td>\n<td>52&#xff08;&#043;1\u9690\u542b&#xff09;<\/td>\n<td>\u7ea6 15-16 \u4f4d<\/td>\n<td>-1022 ~ &#043;1023<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7cbe\u5ea6\u4e0d\u662f\u5dee\u4e00\u500d&#xff0c;\u800c\u662f\u5dee\u4e86\u5927\u7ea6 9 \u4f4d\u5341\u8fdb\u5236\u6709\u6548\u6570\u5b57\u2014\u2014float \u5927\u6982 7 \u4f4d&#xff0c;double \u5927\u6982 15-16 \u4f4d\u3002\u8fd9\u4e2a\u5dee\u8ddd\u975e\u5e38\u5927\u3002<\/p>\n<p>\u4e3e\u4e2a\u5177\u4f53\u7684\u4f8b\u5b50&#xff1a;\u8868\u793a\u4eba\u6c11\u5e01\u91d1\u989d\u65f6&#xff0c;\u5047\u8bbe\u6700\u5927\u91d1\u989d\u662f 100 \u4e07\u4ebf&#xff08;10^14 \u5143&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\u7528 float \u7684\u8bdd&#xff0c;\u7cbe\u5ea6\u5927\u7ea6\u662f 10^14 \/ 2^24 \u2248 600 \u4e07\u5143\u2014\u2014\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u8bef\u5dee\u53ef\u80fd\u6709\u51e0\u767e\u4e07\u5143&#xff0c;\u5b8c\u5168\u4e0d\u80fd\u7528<\/li>\n<li>\u7528 double \u7684\u8bdd&#xff0c;\u7cbe\u5ea6\u5927\u7ea6\u662f 10^14 \/ 2^53 \u2248 0.01 \u5143\u2014\u2014\u5230\u5206\u7ea7\u522b\u57fa\u672c\u591f\u7528&#xff0c;\u4f46\u4e25\u683c\u6765\u8bf4\u8fd8\u662f\u4e0d\u63a8\u8350&#xff08;\u91d1\u878d\u9886\u57df\u5e94\u8be5\u7528\u5b9a\u70b9\u6570\u6216\u5341\u8fdb\u5236\u6d6e\u70b9&#xff09;<\/li>\n<\/ul>\n<p>\u4ec0\u4e48\u65f6\u5019\u7528 float&#xff0c;\u4ec0\u4e48\u65f6\u5019\u7528 double&#xff1f;<\/p>\n<ul>\n<li>\u5185\u5b58\/\u663e\u5b58\u7d27\u5f20\u65f6\u7528 float&#xff1a;\u6bd4\u5982\u56fe\u5f62\u5b66\u3001\u6df1\u5ea6\u5b66\u4e60\u8bad\u7ec3\u4e2d&#xff0c;GPU \u663e\u5b58\u662f\u74f6\u9888&#xff0c;float \u80fd\u7701\u4e00\u534a\u7a7a\u95f4&#xff0c;\u901f\u5ea6\u4e5f\u66f4\u5feb<\/li>\n<li>\u7cbe\u5ea6\u4f18\u5148\u65f6\u7528 double&#xff1a;\u79d1\u5b66\u8ba1\u7b97\u3001\u5de5\u7a0b\u4eff\u771f\u3001\u91d1\u878d\u8ba1\u7b97\u7b49\u5bf9\u7cbe\u5ea6\u8981\u6c42\u9ad8\u7684\u573a\u666f<\/li>\n<li>C \u8bed\u8a00\u9ed8\u8ba4\u662f double&#xff1a;\u6ce8\u610f&#xff01;printf \u91cc\u7684 %f \u5bf9\u5e94\u7684\u662f double&#xff08;\u56e0\u4e3a float \u4f20\u9012\u7ed9\u53ef\u53d8\u53c2\u6570\u51fd\u6570\u65f6\u4f1a\u81ea\u52a8\u63d0\u5347\u4e3a double&#xff09;&#xff0c;3.14 \u8fd9\u6837\u7684\u5b57\u9762\u91cf\u9ed8\u8ba4\u4e5f\u662f double \u7c7b\u578b&#xff0c;\u52a0 f \u540e\u7f00\u624d\u662f float<\/li>\n<\/ul>\n<p>&#x1f4d6; float \u4e0e double \u7684\u9009\u62e9\u672c\u8d28\u662f&#034;\u7cbe\u5ea6-\u7a7a\u95f4-\u901f\u5ea6&#034;\u7684\u4e09\u7ef4\u6743\u8861\u3002\u73b0\u4ee3 CPU \u4e0a double \u548c float \u7684\u8fd0\u7b97\u901f\u5ea6\u5dee\u5f02\u5f88\u5c0f&#xff08;\u90fd\u662f\u4e00\u6761\u6307\u4ee4&#xff09;&#xff0c;\u4e3b\u8981\u5dee\u5f02\u5728\u5185\u5b58\u5e26\u5bbd\u548c\u7f13\u5b58\u5360\u7528\u4e0a\u2014\u2014\u6570\u636e\u91cf\u5c0f\u65f6\u65e0\u8111\u7528 double&#xff0c;\u6570\u636e\u91cf\u5927\u5230\u5185\u5b58\u88c5\u4e0d\u4e0b\u65f6\u518d\u8003\u8651 float \u4f18\u5316\u3002<\/p>\n<hr \/>\n<h2>\u4e94\u3001char \u7c7b\u578b&#xff1a;\u6709\u7b26\u53f7\u8fd8\u662f\u65e0\u7b26\u53f7&#xff1f;\u8fd9\u662f\u4e2a\u95ee\u9898<\/h2>\n<p>\u7b2c\u4e09\u7ae0\u91cc\u8bb2\u4e86 char \u7c7b\u578b\u2014\u2014\u5b83\u7528\u6765\u5b58\u50a8\u5b57\u7b26&#xff0c;\u4f46\u672c\u8d28\u4e0a\u5176\u5b9e\u662f\u4e00\u4e2a 1 \u5b57\u8282\u7684\u6574\u6570\u7c7b\u578b\u3002<\/p>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e2a\u5f88\u5bb9\u6613\u88ab\u5ffd\u7565\u7684\u7ec6\u8282&#xff1a;C \u6807\u51c6\u6ca1\u6709\u89c4\u5b9a char \u662f\u6709\u7b26\u53f7\u8fd8\u662f\u65e0\u7b26\u53f7\u7684\u3002\u8fd9\u662f&#034;\u5b9e\u73b0\u5b9a\u4e49&#034;&#xff08;implementation-defined&#xff09;\u7684\u2014\u2014\u7531\u7f16\u8bd1\u5668\u51b3\u5b9a\u3002<\/p>\n<h3>5.1 \u4e3a\u4ec0\u4e48 char \u7684\u7b26\u53f7\u6027\u4e0d\u786e\u5b9a&#xff1f;<\/h3>\n<p>\u5386\u53f2\u539f\u56e0&#xff1a;\u65e9\u671f\u4e0d\u540c\u7684\u673a\u5668\u5bf9\u5b57\u7b26\u7c7b\u578b\u7684\u5904\u7406\u4e0d\u540c\u3002\u6709\u4e9b\u673a\u5668&#xff08;\u6bd4\u5982\u57fa\u4e8e POWER \u7684\u65e7\u7cfb\u7edf\u3001ARM \u7684\u67d0\u4e9b\u7f16\u8bd1\u5668&#xff09;\u628a char \u5f53\u4f5c\u65e0\u7b26\u53f7\u7684&#xff0c;\u6709\u4e9b\u673a\u5668&#xff08;\u6bd4\u5982 x86 \u4e0a\u7684 GCC\u3001MSVC&#xff09;\u628a char \u5f53\u4f5c\u6709\u7b26\u53f7\u7684\u3002<\/p>\n<p>C \u6807\u51c6\u9009\u62e9\u4e86&#034;\u4e0d\u5f3a\u5236\u89c4\u5b9a&#034;&#xff0c;\u8fd9\u6837\u5728\u4e0d\u540c\u5e73\u53f0\u4e0a\u7f16\u8bd1\u5668\u90fd\u53ef\u4ee5\u9009\u62e9\u6700\u9ad8\u6548\u7684\u5b9e\u73b0\u65b9\u5f0f\u3002<\/p>\n<p>\u4f46\u8fd9\u5c31\u5e26\u6765\u4e86\u53ef\u79fb\u690d\u6027\u95ee\u9898&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> c <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0xFF<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;char is signed\\\\n&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;char is unsigned\\\\n&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5728 x86 \u7684 GCC \u4e0a&#xff0c;\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa \u201cchar is signed\u201d\u2014\u2014\u56e0\u4e3a 0xFF \u4f5c\u4e3a\u6709\u7b26\u53f7 char \u5c31\u662f -1\u3002\u4f46\u5728\u67d0\u4e9b ARM \u7f16\u8bd1\u5668\u4e0a&#xff0c;\u53ef\u80fd\u4f1a\u8f93\u51fa \u201cchar is unsigned\u201d\u3002<\/p>\n<h3>5.2 \u600e\u4e48\u5904\u7406&#xff1f;<\/h3>\n<p>\u5982\u679c\u4f60\u7684\u4ee3\u7801\u4f9d\u8d56 char \u7684\u7b26\u53f7\u6027&#xff08;\u6bd4\u5982\u505a\u6570\u503c\u8ba1\u7b97\u65f6\u628a char \u5f53 1 \u5b57\u8282\u6574\u6570\u7528&#xff09;&#xff0c;\u4e00\u5b9a\u8981\u660e\u786e\u6307\u5b9a&#xff1a;<\/p>\n<ul>\n<li>\u9700\u8981\u6709\u7b26\u53f7&#xff1a;\u7528 signed char<\/li>\n<li>\u9700\u8981\u65e0\u7b26\u53f7&#xff1a;\u7528 unsigned char<\/li>\n<\/ul>\n<p>\u7eaf\u5b57\u7b26\u5904\u7406\u7684\u8bdd&#xff0c;char \u5c31\u884c\u2014\u2014\u53cd\u6b63 ASCII \u7801\u90fd\u5728 0-127 \u8303\u56f4\u5185&#xff0c;\u6709\u7b26\u53f7\u65e0\u7b26\u53f7\u90fd\u4e00\u6837\u3002<\/p>\n<p>\u8fd8\u53ef\u4ee5\u7528\u6807\u51c6\u5e93\u7684 CHAR_MIN \u548c CHAR_MAX \u5b8f&#xff08;\u5b9a\u4e49\u5728 &lt;limits.h&gt; \u91cc&#xff09;\u6765\u5224\u65ad\u5f53\u524d\u5e73\u53f0\u7684 char \u8303\u56f4&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;limits.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;CHAR_MIN &#061; %d\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> CHAR_MIN<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;CHAR_MAX &#061; %d\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> CHAR_MAX<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5982\u679c CHAR_MIN \u662f 0&#xff0c;\u8bf4\u660e char \u662f\u65e0\u7b26\u53f7\u7684<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5982\u679c CHAR_MIN \u662f -128&#xff0c;\u8bf4\u660e char \u662f\u6709\u7b26\u53f7\u7684<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h3>\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48 C \u8bed\u8a00\u91cc\u6709\u8fd9\u4e48\u591a&#034;\u5b9e\u73b0\u5b9a\u4e49&#034;\u548c&#034;\u672a\u5b9a\u4e49\u884c\u4e3a&#034;&#xff1f;<\/h3>\n<p>\u95ee&#xff1a;C \u6807\u51c6\u91cc\u5230\u5904\u90fd\u662f&#034;\u5b9e\u73b0\u5b9a\u4e49&#034;\u3001\u201c\u672a\u6307\u5b9a\u201d\u3001\u201c\u672a\u5b9a\u4e49\u884c\u4e3a\u201d&#xff0c;\u4e3a\u4ec0\u4e48\u4e0d\u5168\u90e8\u89c4\u5b9a\u6b7b&#xff1f;\u8fd9\u6837\u4e0d\u662f\u66f4\u5bb9\u6613\u5199\u51fa\u53ef\u79fb\u690d\u7684\u4ee3\u7801\u5417&#xff1f;<\/p>\n<p>\u7b54&#xff1a;\u8fd9\u5176\u5b9e\u662f C \u8bed\u8a00\u6700\u5927\u7684\u7279\u70b9\u2014\u2014\u4e5f\u662f\u6700\u5927\u7684\u4e89\u8bae\u70b9\u3002\u8981\u7406\u89e3\u8fd9\u4e2a\u8bbe\u8ba1&#xff0c;\u5f97\u56de\u5230 C \u8bed\u8a00\u8bde\u751f\u7684\u5e74\u4ee3&#xff08;1972 \u5e74&#xff09;\u548c\u5b83\u7684\u5b9a\u4f4d\u3002<\/p>\n<p>1. \u6027\u80fd\u4f18\u5148<\/p>\n<p>C \u8bed\u8a00\u7684\u8bbe\u8ba1\u76ee\u6807\u662f&#034;\u5c3d\u53ef\u80fd\u63a5\u8fd1\u786c\u4ef6&#xff0c;\u4f46\u53c8\u4fdd\u6301\u53ef\u79fb\u690d\u6027&#034;\u3002\u5982\u679c\u6807\u51c6\u628a\u6240\u6709\u7ec6\u8282\u90fd\u89c4\u5b9a\u6b7b&#xff0c;\u90a3\u5728\u67d0\u4e9b\u786c\u4ef6\u4e0a\u5c31\u8981\u589e\u52a0\u989d\u5916\u5f00\u9500\u6765\u6ee1\u8db3\u6807\u51c6\u3002\u6bd4\u5982&#xff1a;<\/p>\n<ul>\n<li>\u89c4\u5b9a char \u5fc5\u987b\u662f\u6709\u7b26\u53f7\u7684 \u2192 \u539f\u751f\u65e0\u7b26\u53f7 char \u7684\u5e73\u53f0\u4e0a\u6bcf\u6b21\u4f7f\u7528\u90fd\u8981\u989d\u5916\u5904\u7406<\/li>\n<li>\u89c4\u5b9a\u6574\u6570\u6ea2\u51fa\u5fc5\u987b\u56de\u7ed5 \u2192 \u975e\u8865\u7801\u673a\u5668\u4e0a\u8981\u52a0\u989d\u5916\u7684\u6ea2\u51fa\u68c0\u67e5<\/li>\n<\/ul>\n<p>C \u7684\u54f2\u5b66\u662f&#xff1a;\u4e0d\u4e3a\u4f60\u4e0d\u7528\u7684\u4e1c\u897f\u4ed8\u51fa\u4ee3\u4ef7\u3002\u5982\u679c\u67d0\u4e2a\u884c\u4e3a\u5728\u4e0d\u540c\u5e73\u53f0\u4e0a\u672c\u6765\u5c31\u4e0d\u540c&#xff0c;\u90a3\u5c31\u4e0d\u5f3a\u5236\u7edf\u4e00&#xff0c;\u8ba9\u5404\u5e73\u53f0\u7528\u6700\u9ad8\u6548\u7684\u65b9\u5f0f\u5b9e\u73b0\u3002<\/p>\n<p>2. \u7f16\u8bd1\u5668\u4f18\u5316\u7a7a\u95f4<\/p>\n<p>\u628a\u67d0\u4e9b\u884c\u4e3a\u5b9a\u4e49\u4e3a UB&#xff0c;\u7b49\u4e8e\u544a\u8bc9\u7f16\u8bd1\u5668&#xff1a;\u201c\u4f60\u53ef\u4ee5\u5047\u8bbe\u8fd9\u79cd\u60c5\u51b5\u4e0d\u4f1a\u53d1\u751f\u201d\u3002\u7f16\u8bd1\u5668\u53ef\u4ee5\u57fa\u4e8e\u8fd9\u4e2a\u5047\u8bbe\u505a\u5927\u91cf\u7684\u4f18\u5316\u3002\u4e4b\u524d\u63d0\u5230\u7684\u6709\u7b26\u53f7\u6ea2\u51fa\u4f18\u5316\u5c31\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<p>3. \u5386\u53f2\u5305\u88b1<\/p>\n<p>C \u8bed\u8a00\u8bde\u751f\u65f6&#xff0c;\u8ba1\u7b97\u673a\u4f53\u7cfb\u7ed3\u6784\u6bd4\u73b0\u5728\u591a\u6837\u5f97\u591a\u2014\u2014\u6709\u8865\u7801\u7684&#xff0c;\u6709\u53cd\u7801\u7684&#xff0c;\u6709 36 \u4f4d\u5b57\u957f\u7684&#xff0c;\u6709 9 \u4f4d\u5b57\u8282\u7684\u2026\u2026\u6807\u51c6\u8981\u517c\u5bb9\u6240\u6709\u8fd9\u4e9b\u5e73\u53f0&#xff0c;\u5c31\u4e0d\u53ef\u80fd\u89c4\u5b9a\u5f97\u592a\u6b7b\u3002<\/p>\n<p>\u90a3\u4e48&#xff0c;\u5b9e\u9645\u5199\u4ee3\u7801\u7684\u65f6\u5019\u600e\u4e48\u5e94\u5bf9&#xff1f;<\/p>\n<p>\u5f88\u7b80\u5355&#xff1a;\u907f\u5f00\u6240\u6709&#034;\u5b9e\u73b0\u5b9a\u4e49&#034;\u548c&#034;\u672a\u5b9a\u4e49\u884c\u4e3a&#034;\u7684\u5751\u3002<\/p>\n<table>\n<tr>\u7c7b\u522b\u542b\u4e49\u5e94\u5bf9\u7b56\u7565<\/tr>\n<tbody>\n<tr>\n<td>\u672a\u5b9a\u4e49\u884c\u4e3a&#xff08;UB&#xff09;<\/td>\n<td>\u6807\u51c6\u5b8c\u5168\u6ca1\u89c4\u5b9a&#xff0c;\u4efb\u4f55\u4e8b\u60c5\u90fd\u53ef\u80fd\u53d1\u751f<\/td>\n<td>\u7edd\u5bf9\u4e0d\u8981\u5199<\/td>\n<\/tr>\n<tr>\n<td>\u5b9e\u73b0\u5b9a\u4e49<\/td>\n<td>\u7531\u7f16\u8bd1\u5668\/\u5e73\u53f0\u51b3\u5b9a\u5177\u4f53\u884c\u4e3a&#xff0c;\u4f46\u5fc5\u987b\u6709\u6587\u6863<\/td>\n<td>\u9700\u8981\u53ef\u79fb\u690d\u65f6\u907f\u5f00&#xff0c;\u6216\u6839\u636e\u9884\u5b9a\u4e49\u5b8f\u505a\u6761\u4ef6\u7f16\u8bd1<\/td>\n<\/tr>\n<tr>\n<td>\u672a\u6307\u5b9a\u884c\u4e3a<\/td>\n<td>\u6807\u51c6\u7ed9\u51fa\u51e0\u4e2a\u9009\u9879&#xff0c;\u7f16\u8bd1\u5668\u9009\u4e00\u4e2a&#xff0c;\u4e0d\u7528\u56fa\u5b9a<\/td>\n<td>\u4e0d\u8981\u4f9d\u8d56\u5177\u4f53\u9009\u62e9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f4d6; C \u8bed\u8a00\u7684&#034;\u5bbd\u677e\u6807\u51c6&#034;\u662f\u4e00\u628a\u53cc\u5203\u5251&#xff1a;\u5b83\u8ba9 C \u8bed\u8a00\u80fd\u5728\u5404\u79cd\u786c\u4ef6\u4e0a\u9ad8\u6548\u8fd0\u884c&#xff0c;\u4e5f\u8ba9\u7a0b\u5e8f\u5458\u627f\u62c5\u4e86\u66f4\u591a\u7684\u8d23\u4efb\u3002\u597d\u7684 C \u7a0b\u5e8f\u5458\u4e0d\u53ea\u662f\u4f1a\u5199\u80fd\u8dd1\u7684\u4ee3\u7801&#xff0c;\u66f4\u662f\u6e05\u695a\u5730\u77e5\u9053\u54ea\u4e9b\u884c\u4e3a\u662f\u6807\u51c6\u4fdd\u8bc1\u7684\u3001\u54ea\u4e9b\u662f\u78b0\u90fd\u4e0d\u80fd\u78b0\u7684\u96f7\u533a\u3002\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u6709\u4eba\u8bf4&#034;C \u7a0b\u5e8f\u5458\u662f\u5bf9\u786c\u4ef6\u7406\u89e3\u6700\u6df1\u523b\u7684\u7a0b\u5e8f\u5458&#034;\u3002<\/p>\n<hr \/>\n<h2>\u516d\u3001\u5927\u5c0f\u7aef&#xff1a;\u591a\u5b57\u8282\u6570\u636e\u7684\u5b58\u50a8\u987a\u5e8f<\/h2>\n<p>\u7b2c\u4e09\u7ae0\u8bb2\u4e86\u6570\u636e\u7c7b\u578b\u7684\u5927\u5c0f&#xff0c;\u4f46\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u8bdd\u9898\u4e66\u91cc\u6ca1\u5c55\u5f00\u2014\u2014\u591a\u5b57\u8282\u6570\u636e\u5728\u5185\u5b58\u4e2d\u662f\u600e\u4e48\u6392\u5217\u7684&#xff1f; \u4e5f\u5c31\u662f&#034;\u5927\u5c0f\u7aef&#034;\u95ee\u9898\u3002<\/p>\n<h3>6.1 \u4ec0\u4e48\u662f\u5927\u5c0f\u7aef&#xff1f;<\/h3>\n<p>\u4ee5\u4e00\u4e2a 4 \u5b57\u8282\u7684\u6574\u6570 0x12345678 \u4e3a\u4f8b&#xff0c;\u5b83\u7684\u9ad8\u4f4d\u5b57\u8282\u662f 0x12&#xff0c;\u4f4e\u4f4d\u5b57\u8282\u662f 0x78\u3002\u5b58\u5230\u5185\u5b58\u91cc\u6709\u4e24\u79cd\u65b9\u5f0f&#xff1a;<\/p>\n<p>\u5927\u7aef&#xff08;Big Endian&#xff09;&#xff1a;\u9ad8\u5b57\u8282\u5b58\u5728\u4f4e\u5730\u5740<\/p>\n<p>\u5730\u5740\u9012\u589e \u2192<br \/>\n&#043;&#8212;-&#043;&#8212;-&#043;&#8212;-&#043;&#8212;-&#043;<br \/>\n| 12 | 34 | 56 | 78 |<br \/>\n&#043;&#8212;-&#043;&#8212;-&#043;&#8212;-&#043;&#8212;-&#043;<br \/>\n\u4f4e\u5730\u5740                \u9ad8\u5730\u5740<\/p>\n<p>\u5c0f\u7aef&#xff08;Little Endian&#xff09;&#xff1a;\u4f4e\u5b57\u8282\u5b58\u5728\u4f4e\u5730\u5740<\/p>\n<p>\u5730\u5740\u9012\u589e \u2192<br \/>\n&#043;&#8212;-&#043;&#8212;-&#043;&#8212;-&#043;&#8212;-&#043;<br \/>\n| 78 | 56 | 34 | 12 |<br \/>\n&#043;&#8212;-&#043;&#8212;-&#043;&#8212;-&#043;&#8212;-&#043;<br \/>\n\u4f4e\u5730\u5740                \u9ad8\u5730\u5740<\/p>\n<p>\u540d\u5b57\u7684\u7531\u6765\u5f88\u6709\u610f\u601d\u2014\u2014\u51fa\u81ea\u300a\u683c\u5217\u4f5b\u6e38\u8bb0\u300b&#xff0c;\u5c0f\u4eba\u56fd\u91cc\u4e24\u6d3e\u4eba\u4e89\u8bba\u5403\u9e21\u86cb\u5e94\u8be5\u4ece\u5927\u5934&#xff08;Big End&#xff09;\u6572\u5f00\u8fd8\u662f\u4ece\u5c0f\u5934&#xff08;Little End&#xff09;\u6572\u5f00&#xff0c;\u5435\u5f97\u4e0d\u53ef\u5f00\u4ea4\u3002\u5927\u5c0f\u7aef\u4e4b\u4e89\u4e5f\u662f\u4e00\u6837&#xff0c;\u5404\u6709\u5404\u7684\u9053\u7406&#xff0c;\u8c01\u4e5f\u8bf4\u670d\u4e0d\u4e86\u8c01\u3002<\/p>\n<h3>6.2 \u4e3a\u4ec0\u4e48\u4f1a\u6709\u4e24\u79cd\u5b57\u8282\u5e8f&#xff1f;<\/h3>\n<p>\u5927\u7aef\u7684\u597d\u5904&#xff1a;<\/p>\n<ul>\n<li>\u7b26\u5408\u4eba\u7c7b\u9605\u8bfb\u4e60\u60ef&#xff08;\u548c\u5199\u6570\u5b57\u7684\u987a\u5e8f\u4e00\u81f4&#xff09;<\/li>\n<li>\u5148\u8bfb\u5230\u9ad8\u5b57\u8282\u5c31\u80fd\u77e5\u9053\u6570\u7684\u6b63\u8d1f\u548c\u5927\u81f4\u5927\u5c0f<\/li>\n<li>\u9002\u5408\u5b57\u7b26\u4e32\u548c\u5927\u6570\u6bd4\u8f83<\/li>\n<\/ul>\n<p>\u5c0f\u7aef\u7684\u597d\u5904&#xff1a;<\/p>\n<ul>\n<li>\u4f4e\u5b57\u8282\u5728\u4f4e\u5730\u5740&#xff0c;\u505a\u52a0\u6cd5\u65f6\u4ece\u4f4e\u5b57\u8282\u5f00\u59cb\u8fdb\u4f4d&#xff0c;\u548c\u8ba1\u7b97\u987a\u5e8f\u4e00\u81f4<\/li>\n<li>\u7c7b\u578b\u8f6c\u6362\u65b9\u4fbf&#xff1a;int \u8f6c short \u76f4\u63a5\u53d6\u4f4e 2 \u5b57\u8282\u5c31\u884c&#xff0c;\u5730\u5740\u4e0d\u7528\u53d8<\/li>\n<li>x86 \u67b6\u6784\u91c7\u7528\u5c0f\u7aef&#xff0c;\u73b0\u5728\u6700\u4e3b\u6d41<\/li>\n<\/ul>\n<p>\u73b0\u5728\u7684 PC \u51e0\u4e4e\u90fd\u662f\u5c0f\u7aef&#xff08;x86 \/ x86_64 \/ ARM \u5927\u90e8\u5206\u60c5\u51b5&#xff09;\u3002\u4f46\u7f51\u7edc\u534f\u8bae&#xff08;TCP\/IP&#xff09;\u7528\u7684\u662f\u5927\u7aef\u5b57\u8282\u5e8f&#xff0c;\u6240\u4ee5\u7f51\u7edc\u7f16\u7a0b\u91cc\u7ecf\u5e38\u8981\u7528 htons \/ htonl \/ ntohs \/ ntohl \u8fd9\u4e9b\u51fd\u6570\u505a\u8f6c\u6362\u2014\u2014h \u4ee3\u8868 host&#xff08;\u4e3b\u673a\u5b57\u8282\u5e8f&#xff09;&#xff0c;n \u4ee3\u8868 network&#xff08;\u7f51\u7edc\u5b57\u8282\u5e8f&#xff09;&#xff0c;s \u662f short&#xff0c;l \u662f long\u3002<\/p>\n<h3>6.3 \u7528 C \u4ee3\u7801\u5224\u65ad\u5927\u5c0f\u7aef<\/h3>\n<p>\u600e\u4e48\u7528\u7a0b\u5e8f\u5224\u65ad\u5f53\u524d\u5e73\u53f0\u662f\u5927\u7aef\u8fd8\u662f\u5c0f\u7aef&#xff1f;\u7ecf\u5178\u9762\u8bd5\u9898&#xff0c;\u65b9\u6cd5\u662f\u5229\u7528 union&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">is_little_endian<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">void<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">union<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">int<\/span> i<span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">char<\/span> c<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span> u<span class=\"token punctuation\">;<\/span><br \/>\n    u<span class=\"token punctuation\">.<\/span>i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> u<span class=\"token punctuation\">.<\/span>c<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u5c0f\u7aef\u8fd4\u56de 1&#xff0c;\u5927\u7aef\u8fd4\u56de 0<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token function\">is_little_endian<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5c0f\u7aef\u5b57\u8282\u5e8f\\\\n&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5927\u7aef\u5b57\u8282\u5e8f\\\\n&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u539f\u7406&#xff1a;union \u7684\u6240\u6709\u6210\u5458\u5171\u4eab\u540c\u4e00\u5757\u5185\u5b58\u3002\u628a int \u7684\u503c\u8bbe\u4e3a 1&#xff0c;\u5982\u679c\u662f\u5c0f\u7aef&#xff0c;\u6700\u4f4e\u5b57\u8282\u5c31\u662f 1&#xff0c;\u5b58\u5728\u6700\u4f4e\u5730\u5740&#xff1b;char \u8bfb\u53d6\u6700\u4f4e\u5730\u5740\u7684\u90a3\u4e2a\u5b57\u8282&#xff0c;\u5c31\u662f 1\u3002\u5982\u679c\u662f\u5927\u7aef&#xff0c;\u6700\u4f4e\u5b57\u8282\u662f 0&#xff0c;char \u8bfb\u5230\u7684\u5c31\u662f 0\u3002<\/p>\n<p>\u26a0\ufe0f \u6ce8\u610f&#xff1a;\u5728 C \u6807\u51c6\u4e2d&#xff0c;\u4ece union \u7684\u4e0d\u540c\u6210\u5458\u8bfb\u53d6\u6570\u636e&#xff08;\u7c7b\u578b\u53cc\u5173&#xff09;\u662f\u6709\u4e89\u8bae\u7684\u3002C99 \u660e\u786e\u652f\u6301\u8fd9\u79cd\u7528\u6cd5&#xff08;6.5.2.3 \u811a\u6ce8 95&#xff09;&#xff0c;\u4f46 C&#043;&#043; \u6807\u51c6\u4e2d\u662f\u672a\u5b9a\u4e49\u884c\u4e3a\u3002C \u8bed\u8a00\u91cc\u53ef\u4ee5\u653e\u5fc3\u7528&#xff0c;C&#043;&#043; \u91cc\u63a8\u8350\u7528 memcpy \u6216 std::bit_cast&#xff08;C&#043;&#043;20&#xff09;\u3002<\/p>\n<hr \/>\n<h3>\u6df1\u5ea6\u601d\u8003&#xff1a;\u9664\u4e86\u5927\u5c0f\u7aef&#xff0c;\u8fd8\u6709&#034;\u4e2d\u95f4\u7aef&#034;\u5417&#xff1f;<\/h3>\n<p>\u95ee&#xff1a;\u6211\u597d\u50cf\u542c\u8bf4\u8fc7\u4ec0\u4e48&#034;\u4e2d\u7aef&#034;\u6216\u8005&#034;\u6df7\u5408\u5b57\u8282\u5e8f&#034;&#xff0c;\u771f\u7684\u5b58\u5728\u5417&#xff1f;<\/p>\n<p>\u7b54&#xff1a;\u786e\u5b9e\u5b58\u5728\u3002\u5b57\u8282\u5e8f\u4e0d\u53ea\u662f&#034;\u5927\u7aef \/ \u5c0f\u7aef&#034;\u4e8c\u5143\u5bf9\u7acb\u7684&#xff0c;\u8fd8\u6709\u66f4\u590d\u6742\u7684\u60c5\u51b5\u3002<\/p>\n<p>PDP-11 \u7684\u4e2d\u95f4\u7aef&#xff08;Middle Endian&#xff09;<\/p>\n<p>\u5386\u53f2\u4e0a DEC \u7684 PDP-11 \u673a\u5668\u6709\u4e00\u79cd\u5f88\u5947\u602a\u7684\u5b58\u50a8\u65b9\u5f0f&#xff1a;\u5bf9\u4e8e 32 \u4f4d\u6574\u6570 0x12345678&#xff0c;\u5b83\u4f1a\u5b58\u6210 34 12 78 56\u3002\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u5b83\u628a 32 \u4f4d\u6570\u5f53\u6210\u4e24\u4e2a 16 \u4f4d\u7684&#034;\u534a\u5b57&#034;&#xff0c;\u6bcf\u4e2a\u534a\u5b57\u5185\u90e8\u662f\u5c0f\u7aef&#xff0c;\u4f46\u534a\u5b57\u4e4b\u95f4\u662f\u5927\u7aef\u6392\u5217\u3002\u8fd9\u79cd\u5b58\u50a8\u65b9\u5f0f\u6709\u65f6\u5019\u4e5f\u53eb PDP \u5b57\u8282\u5e8f\u6216\u8005\u6df7\u5408\u5b57\u8282\u5e8f\u3002<\/p>\n<p>\u73b0\u5728\u8fd9\u79cd\u673a\u5668\u5df2\u7ecf\u5f88\u5c11\u89c1\u4e86&#xff0c;\u6240\u4ee5\u4e00\u822c\u8ba8\u8bba\u5b57\u8282\u5e8f\u7684\u65f6\u5019\u8fd8\u662f\u9ed8\u8ba4\u53ea\u6709\u5927\u7aef\u548c\u5c0f\u7aef\u4e24\u79cd\u3002<\/p>\n<p>\u4f4d\u5e8f\u5462&#xff1f;\u5b57\u8282\u5185\u90e8\u7684 bit \u987a\u5e8f\u9700\u8981\u8003\u8651\u5417&#xff1f;<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u95ee\u5f97\u5f88\u6df1\u5165\u3002\u7b54\u6848\u662f&#xff1a;\u901a\u5e38\u4e0d\u9700\u8981\u3002\u56e0\u4e3a CPU \u5bf9\u5b57\u8282\u5185\u90e8\u7684\u4f4d\u64cd\u4f5c\u662f\u5c01\u88c5\u597d\u7684\u2014\u2014\u4f60\u7528\u5de6\u79fb\u53f3\u79fb\u8fd0\u7b97\u7b26&#xff0c;\u5f97\u5230\u7684\u7ed3\u679c\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u662f\u4e00\u81f4\u7684&#xff0c;\u786c\u4ef6\u4f1a\u5904\u7406\u597d\u4f4d\u5e8f\u7684\u7ec6\u8282\u3002<\/p>\n<p>\u53ea\u6709\u5f53\u4f60\u9700\u8981\u505a\u4f4d\u7ea7\u522b\u7684\u4e32\u884c\u4f20\u8f93&#xff08;\u6bd4\u5982 SPI \u901a\u4fe1&#xff09;\u3001\u6216\u8005\u5904\u7406\u538b\u7f29\u683c\u5f0f\u7684\u4f4d\u57df\u65f6&#xff0c;\u624d\u9700\u8981\u5173\u5fc3\u5b57\u8282\u5185\u90e8\u7684\u4f4d\u5e8f&#xff08;\u53eb bit-endianness \u6216 bit numbering&#xff09;\u3002\u5bf9\u4e8e\u666e\u901a\u7684 C \u8bed\u8a00\u7f16\u7a0b&#xff0c;\u8fd9\u4e2a\u95ee\u9898\u57fa\u672c\u9047\u4e0d\u5230\u3002<\/p>\n<p>&#x1f4d6; \u5b57\u8282\u5e8f\u95ee\u9898\u7684\u672c\u8d28\u662f&#xff1a;\u5f53\u6570\u636e\u88ab\u62c6\u5206\u6210\u66f4\u5c0f\u7684\u5355\u5143\u5b58\u50a8\u6216\u4f20\u8f93\u65f6&#xff0c;\u5355\u5143\u4e4b\u95f4\u7684\u6392\u5217\u987a\u5e8f\u53ef\u80fd\u4e0d\u4e00\u81f4\u3002\u8fd9\u4e2a\u95ee\u9898\u65e0\u5904\u4e0d\u5728\u2014\u2014\u5b57\u8282\u4e4b\u95f4\u6709\u5b57\u8282\u5e8f&#xff0c;\u4f4d\u4e4b\u95f4\u6709\u4f4d\u5e8f&#xff0c;\u7f51\u7edc\u4f20\u8f93\u6709\u7f51\u7edc\u5b57\u8282\u5e8f&#xff0c;\u6587\u4ef6\u683c\u5f0f\u6709\u6587\u4ef6\u5b57\u8282\u5e8f\u3002\u7406\u89e3\u5927\u5c0f\u7aef\u4e0d\u53ea\u662f\u4e3a\u4e86\u8fc7\u9762\u8bd5&#xff0c;\u66f4\u662f\u7406\u89e3&#034;\u6570\u636e\u7684\u8868\u793a\u4e0d\u662f\u552f\u4e00\u7684&#034;\u8fd9\u4e2a\u5e95\u5c42\u8ba4\u77e5\u3002<\/p>\n<hr \/>\n<h2>&#x1f4dd; \u603b\u7ed3<\/h2>\n<p>\u867d\u7136\u53ea\u662f\u7b2c1-3\u7ae0\u7684\u5165\u95e8\u5185\u5bb9&#xff0c;\u4f46\u5f80\u6df1\u4e86\u6316\u80fd\u6316\u51fa\u6765\u7684\u4e1c\u897f\u771f\u7684\u4e0d\u5c11&#xff1a;<\/p>\n<li>C \u8bed\u8a00\u7684\u672c\u8d28&#xff1a;\u96f6\u5f00\u9500\u62bd\u8c61\u3001\u9760\u8fd1\u786c\u4ef6\u3001\u4fe1\u4efb\u7a0b\u5e8f\u5458\u3002\u7406\u89e3\u8fd9\u4e9b\u8bbe\u8ba1\u54f2\u5b66\u6bd4\u6b7b\u8bb0\u8bed\u6cd5\u91cd\u8981\u5f97\u591a<\/li>\n<li>\u8865\u7801&#xff1a;\u4e0d\u662f\u4ec0\u4e48&#034;\u53cd\u7801\u52a01&#034;\u7684\u53e3\u8bc0&#xff0c;\u800c\u662f\u6a21\u8fd0\u7b97\u7684\u5fc5\u7136\u7ed3\u679c&#xff0c;\u662f\u52a0\u6cd5\u7535\u8def\u7edf\u4e00\u5316\u7684\u5173\u952e<\/li>\n<li>IEEE 754&#xff1a;\u9690\u542b 1\u3001\u504f\u7f6e\u6307\u6570\u3001\u975e\u89c4\u683c\u5316\u6570&#xff0c;\u6bcf\u4e00\u4e2a\u8bbe\u8ba1\u7ec6\u8282\u90fd\u662f\u4e3a\u4e86\u5728\u6709\u9650\u7684\u4f4d\u6570\u91cc\u505a\u5230\u7cbe\u5ea6\u548c\u8303\u56f4\u7684\u6700\u4f18\u5e73\u8861<\/li>\n<li>\u672a\u5b9a\u4e49\u884c\u4e3a&#xff1a;C \u8bed\u8a00\u6700\u5927\u7684\u5751&#xff0c;\u4e5f\u662f C \u8bed\u8a00\u9ad8\u6548\u7684\u539f\u56e0\u3002\u7406\u89e3 UB \u662f\u5165\u95e8\u548c\u8fdb\u9636\u7684\u5206\u6c34\u5cad<\/li>\n<li>\u5927\u5c0f\u7aef&#xff1a;\u4e0d\u53ea\u662f\u9762\u8bd5\u9898&#xff0c;\u800c\u662f\u7406\u89e3&#034;\u6570\u636e\u8868\u793a\u4e0d\u662f\u552f\u4e00\u7684&#034;\u8fd9\u4e2a\u5e95\u5c42\u8ba4\u77e5\u7684\u94a5\u5319<\/li>\n<p>\u7b2c\u4e00\u5929\u7684\u5185\u5bb9\u770b\u4f3c\u7b80\u5355&#xff0c;\u4f46\u8fd9\u4e9b\u5e95\u5c42\u6982\u5ff5\u5176\u5b9e\u8d2f\u7a7f\u4e86\u6574\u4e2a C \u8bed\u8a00\u7684\u5b66\u4e60\u3002\u628a\u8fd9\u4e9b\u57fa\u7840\u6253\u624e\u5b9e\u4e86&#xff0c;\u540e\u9762\u5b66\u6307\u9488\u3001\u5b66\u5185\u5b58\u7ba1\u7406\u3001\u5b66\u7ed3\u6784\u4f53\u90fd\u4f1a\u987a\u5f88\u591a\u3002<\/p>\n<p>\u660e\u5929\u7ee7\u7eed\u7b2c4-5\u7ae0&#xff1a;\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u8f93\u5165\u8f93\u51fa &#043; \u8fd0\u7b97\u7b26\u8868\u8fbe\u5f0f\u548c\u8bed\u53e5&#xff5e;<\/p>\n<p>\u70b9\u4e2a\u8d5e\u6536\u85cf\u4e00\u4e0b\u5457&#xff5e;\u6709\u7406\u89e3\u4e0d\u5bf9\u7684\u5730\u65b9\u6b22\u8fce\u8bc4\u8bba\u533a\u6307\u6b63&#xff01;<\/p>\n<hr \/>\n<h2>&#x1f4da; \u53c2\u8003\u8d44\u6599<\/h2>\n<ul>\n<li>C Primer Plus&#xff08;\u7b2c6\u7248&#xff09;\u4e2d\u6587\u7248 \u2014 Stephen Prata \u8457&#xff0c;\u59dc\u4f51 \u8bd1<\/li>\n<li>IEEE Std 754-2008: IEEE Standard for Floating-Point Arithmetic<\/li>\n<li>ISO\/IEC 9899:2011 (C11 \u6807\u51c6)<\/li>\n<li>cppreference.com: C programming language reference<\/li>\n<li>\u6df1\u5165\u7406\u89e3\u8ba1\u7b97\u673a\u7cfb\u7edf&#xff08;CSAPP&#xff09; \u2014 Randal E. Bryant \u7b49\u8457<\/li>\n<\/ul>\n<p>\u63a8\u8350\u6807\u7b7e&#xff1a;C\u8bed\u8a00\u3001\u8865\u7801\u3001IEEE754\u3001\u5927\u5c0f\u7aef\u3001\u6570\u636e\u7c7b\u578b\u3001C Primer Plus \u63a8\u8350\u5206\u7c7b&#xff1a;C\/C&#043;&#043; \/ \u5b66\u4e60\u7b14\u8bb0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 \u4ece\u6570\u636e\u5e95\u5c42\u51fa\u53d1&#xff1a;\u6574\u6570\u8865\u7801\u3001\u6d6e\u70b9\u6570IEEE 754\u4e0e\u5927\u5c0f\u7aef\u7684\u6df1\u5ea6\u62c6\u89e3&#x1f3af; \u524d\u8a00\u4e00\u3001C\u8bed\u8a00\u4e3a\u4ec0\u4e48\u503c\u5f97\u5b66&#xff1a;\u4ece\\&#8221;\u7cfb\u7edf\u7ea7\u8bed\u8a00\\&#8221;\u7684\u672c\u8d28\u8bf4\u8d77\u4e8c\u3001\u7b2c\u4e00\u4e2aC\u7a0b\u5e8f\u80cc\u540e&#xff1a;\u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5206\u8fd9\u4e48\u591a\u9636\u6bb5&#xff1f;\u4e09\u3001\u6574\u6570&#xff1a;\u4ece\u539f\u7801\u53cd\u7801\u5230\u8865\u7801&#xff0c;\u4e00\u6b21\u8bf4\u6e05\u695a3.1 \u539f\u7801\u3001\u53cd\u7801\u3001\u8865\u7801&#xff1a;\u4e09\u5144\u5f1f\u7684\u6545\u4e8b3.2 \u8865\u7801\u7684\u6570\u5b66\u672c\u8d283.3 \u6574\u6570<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11653,55,174,81,270,190],"topic":[],"class_list":["post-108079","post","type-post","status-publish","format-standard","hentry","category-server","tag-11653","tag-c","tag-python","tag-270","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/108079.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 \u4ece\u6570\u636e\u5e95\u5c42\u51fa\u53d1&#xff1a;\u6574\u6570\u8865\u7801\u3001\u6d6e\u70b9\u6570IEEE 754\u4e0e\u5927\u5c0f\u7aef\u7684\u6df1\u5ea6\u62c6\u89e3&#x1f3af; \u524d\u8a00\u4e00\u3001C\u8bed\u8a00\u4e3a\u4ec0\u4e48\u503c\u5f97\u5b66&#xff1a;\u4ece&quot;\u7cfb\u7edf\u7ea7\u8bed\u8a00&quot;\u7684\u672c\u8d28\u8bf4\u8d77\u4e8c\u3001\u7b2c\u4e00\u4e2aC\u7a0b\u5e8f\u80cc\u540e&#xff1a;\u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5206\u8fd9\u4e48\u591a\u9636\u6bb5&#xff1f;\u4e09\u3001\u6574\u6570&#xff1a;\u4ece\u539f\u7801\u53cd\u7801\u5230\u8865\u7801&#xff0c;\u4e00\u6b21\u8bf4\u6e05\u695a3.1 \u539f\u7801\u3001\u53cd\u7801\u3001\u8865\u7801&#xff1a;\u4e09\u5144\u5f1f\u7684\u6545\u4e8b3.2 \u8865\u7801\u7684\u6570\u5b66\u672c\u8d283.3 \u6574\u6570\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/108079.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-20T14:32:44+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108079.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/108079.html\",\"name\":\"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-20T14:32:44+00:00\",\"dateModified\":\"2026-09-20T14:32:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/108079.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/108079.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108079.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/108079.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 \u4ece\u6570\u636e\u5e95\u5c42\u51fa\u53d1&#xff1a;\u6574\u6570\u8865\u7801\u3001\u6d6e\u70b9\u6570IEEE 754\u4e0e\u5927\u5c0f\u7aef\u7684\u6df1\u5ea6\u62c6\u89e3&#x1f3af; \u524d\u8a00\u4e00\u3001C\u8bed\u8a00\u4e3a\u4ec0\u4e48\u503c\u5f97\u5b66&#xff1a;\u4ece\"\u7cfb\u7edf\u7ea7\u8bed\u8a00\"\u7684\u672c\u8d28\u8bf4\u8d77\u4e8c\u3001\u7b2c\u4e00\u4e2aC\u7a0b\u5e8f\u80cc\u540e&#xff1a;\u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u6df1\u5ea6\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5206\u8fd9\u4e48\u591a\u9636\u6bb5&#xff1f;\u4e09\u3001\u6574\u6570&#xff1a;\u4ece\u539f\u7801\u53cd\u7801\u5230\u8865\u7801&#xff0c;\u4e00\u6b21\u8bf4\u6e05\u695a3.1 \u539f\u7801\u3001\u53cd\u7801\u3001\u8865\u7801&#xff1a;\u4e09\u5144\u5f1f\u7684\u6545\u4e8b3.2 \u8865\u7801\u7684\u6570\u5b66\u672c\u8d283.3 \u6574\u6570","og_url":"https:\/\/www.wsisp.com\/helps\/108079.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-20T14:32:44+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/108079.html","url":"https:\/\/www.wsisp.com\/helps\/108079.html","name":"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-20T14:32:44+00:00","dateModified":"2026-09-20T14:32:44+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/108079.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/108079.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/108079.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010C Primer Plus \u7cbe\u8bfb\u3011Day1"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=108079"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108079\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=108079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=108079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=108079"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=108079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}