{"id":30,"date":"2024-10-12T14:20:32","date_gmt":"2024-10-12T06:20:32","guid":{"rendered":"http:\/\/47.108.173.172\/?p=30"},"modified":"2024-11-15T16:55:23","modified_gmt":"2024-11-15T08:55:23","slug":"%e5%ae%8f","status":"publish","type":"post","link":"https:\/\/xieg.top\/index.php\/2024\/10\/12\/%e5%ae%8f\/","title":{"rendered":"\u5b8f"},"content":{"rendered":"\n<p>\u7b80\u5355\u793a\u4f8b<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10);font-size:clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.313), 17px);line-height:1.5\"><code>printf(\"hello\\  \/\/ \u7f16\u8bd1\u5668\u4f1a\u5220\u9664\u8be5\u53cd\u659c\u6760, \u7136\u540e\u5c06\u4e24\u4e2a\u7269\u7406\u884c\u8f6c\u6362\u6210\u4e00\u4e2a\u903b\u8f91\u884c\n        world\\n\");\nprintf(\"hello world\\n\");  \/\/ \u8f6c\u6362\u7ed3\u679c<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<p><strong>\u660e\u793a\u5e38\u91cf#define<\/strong><\/p>\n\n\n\n<p>\u5b8f\u5b9a\u4e49<code>\u4ec5\u8fdb\u884c\u66ff\u6362<\/code>, <code>\u4e0d\u4f1a\u6c42\u503c<\/code>, \u4e0d\u4f1a\u6c42\u503c, \u4e0d\u4f1a\u6c42\u503c<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10);line-height:1.5\"><code>#define PI 3.1415926  \/\/ \u7c7b\u5bf9\u8c61\u5b8f\n#define message \"hello world\\n\"\n#define PX(x) printf(\"X is %d\\n\", x)  \/\/ \u7c7b\u51fd\u6570\u5b8f\n#define FMT \"X is %d\\n\"\n\nint x = 1101;\nPX(x);\nprintf(\"%s\", message);\nprintf(FMT, x);<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10)\"><code>#define PX(x) printf(\"the \"#x\"\" is %d\\n\", x)  \/\/ \u6ce8\u610f\u53cc\u5f15\u53f7\n\nint val = 1101;\nPX(val);  \/\/ the val is 1101<\/code><\/pre>\n\n\n\n<p><strong>&#8230;\u548c__VA_ARGS__<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10)\"><code>#define PR(...) printf(\"message\" __VA_ARGS__)\n\nPR(\"hello world\\n\");  \/\/ printf(\"message\" \"hello world\\n\");<\/code><\/pre>\n\n\n\n<p><strong>#undef<\/strong><\/p>\n\n\n\n<p>\u7528\u4e8e\u53d6\u6d88\u5df2\u7ecf\u5b9a\u4e49\u7684<code>#define<\/code>\u6307\u4ee4<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10)\"><code>#define LIMIT 400\n#undef LIMIT  \/\/ \u79fb\u9664\u4e86\u4e0a\u9762\u7684\u5b9a\u4e49 \u73b0\u5728\u53ef\u4ee5\u628aLIMIT\u91cd\u65b0\u5b9a\u4e49\u4e3a\u65b0\u7684\u503c<\/code><\/pre>\n\n\n\n<p><strong>\u9884\u5b9a\u4e49\u5b8f<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u5b8f<\/th><th>\u542b\u4e49<\/th><\/tr><\/thead><tbody><tr><td><code>__DATE__<\/code><\/td><td>\u9884\u5904\u7406\u7684\u65e5\u671f\uff08&#8221;Mmm dd yyyy&#8221; \u5f62\u5f0f\u7684\u5b57\u7b26\u4e32\u5b57\u9762\u91cf\uff0c\u5982 Nov 23 2013\uff09<\/td><\/tr><tr><td><code>__FILE__<\/code><\/td><td>\u8868\u793a\u5f53\u524d\u6e90\u4ee3\u7801\u6587\u4ef6\u540d\u7684\u5b57\u7b26\u4e32\u5b57\u9762\u91cf<\/td><\/tr><tr><td><code>__LINE__<\/code><\/td><td>\u8868\u793a\u5f53\u524d\u6e90\u4ee3\u7801\u6587\u4ef6\u4e2d\u884c\u53f7\u7684\u6574\u578b\u5e38\u91cf<\/td><\/tr><tr><td><code>__STDC__<\/code><\/td><td>\u8bbe\u7f6e\u4e3a 1 \u65f6\uff0c\u8868\u660e\u5b9e\u73b0\u9075\u5faa C \u6807\u51c6<\/td><\/tr><tr><td><code>__STDC_HOSTED__<\/code><\/td><td>\u672c\u673a\u73af\u5883\u8bbe\u7f6e\u4e3a 1\uff1b\u5426\u5219\u8bbe\u7f6e\u4e3a 0<\/td><\/tr><tr><td><code>__STDC_VERSION__<\/code><\/td><td>\u652f\u6301 C99 \u6807\u51c6\uff0c\u8bbe\u7f6e\u4e3a 199901L\uff1b\u652f\u6301 C11 \u6807\u51c6\uff0c\u8bbe\u7f6e\u4e3a 201112L<\/td><\/tr><tr><td><code>__TIME__<\/code><\/td><td>\u7f16\u8bd1\u4ee3\u7801\u7684\u65f6\u95f4\uff0c\u683c\u5f0f\u4e3a &#8220;hh:mm:ss&#8221;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10)\"><code>printf(\"Current date: %s\\n\", __DATE__);  \/\/ Current date: Aug 14 2024\nprintf(\"Current time: %s\\n\", __TIME__);  \/\/ Current time: 16:28:00\nprintf(\"This file is: %s\\n\", __FILE__);\n\/\/ This file is: C:\\Users\\John2\\Documents\\VS_Code\\C\\learn\\header\\define.c\nprintf(\"This is line number: %d\\n\", __LINE__);  \/\/ This is line number: 12<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10);line-height:1.5\"><code>#ifdef __STDC__\n    printf(\"This compiler conforms to the C standard\\n\");\n#else\n    printf(\"This compiler does not conform to the C standard\\n\");\n#endif  \/\/ This compiler conforms to the C standard\n\n#if __STDC_HOSTED__\n    printf(\"This is a hosted environment\\n\");\n#else\n    printf(\"This is a freestanding environment\\n\");\n#endif  \/\/ This is a hosted environment\n\n#if __STDC_VERSION__ &gt;= 201112L\n    printf(\"C11 standard supported\\n\");\n#elif __STDC_VERSION__ &gt;= 199901L\n    printf(\"C99 standard supported\\n\");\n#else\n    printf(\"C89\/C90 standard supported\\n\");\n#endif  \/\/ C11 standard supported<\/code><\/pre>\n\n\n\n<p><strong><code>__func__<\/code><\/strong><\/p>\n\n\n\n<p>C99 \u6807\u51c6\u63d0\u4f9b\u4e00\u4e2a\u540d\u4e3a <code>__func__<\/code>\u7684\u9884\u5b9a\u4e49\u6807\u8bc6\u7b26, \u5b83\u5c55\u5f00\u4e3a\u4e00\u4e2a\u4ee3\u8868\u51fd\u6570\u540d\u7684\u5b57\u7b26\u4e32(\u8be5\u51fd\u6570\u5305\u542b\u8be5\u6807\u8bc6\u7b26). \u90a3\u4e48, <code>__func__<\/code> \u5fc5\u987b\u5177\u6709\u51fd\u6570\u4f5c\u7528\u57df, \u800c\u4ece\u672c\u8d28\u4e0a\u770b\u5b8f\u5177\u6709\u6587\u4ef6\u4f5c\u7528\u57df\u3002\u56e0\u6b64, <code>__func__<\/code> \u662f C \u8bed\u8a00\u7684\u9884\u5b9a\u4e49\u6807\u8bc6\u7b26, \u800c\u4e0d\u662f\u9884\u5b9a\u4e49\u5b8f<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10);line-height:1.5\"><code>void why_me()\n{\n    printf(\"This function is %s\\n\", __func__);\n}  \/\/ This function is why_me<\/code><\/pre>\n\n\n\n<p><strong>#line\u548c#error<\/strong><\/p>\n\n\n\n<p><code>#line<\/code>\u7528\u4e8e\u91cd\u7f6e\u5f53\u524d\u884c\u53f7\u548c\u6587\u4ef6\u540d<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10);line-height:1.5\"><code>#line 1101 \"hello.c\"<\/code><\/pre>\n\n\n\n<p><code>#error<\/code>\u8ba9\u9884\u5904\u7406\u5668\u53d1\u51fa\u4e00\u6761\u9519\u8bef\u4fe1\u606f, \u5e76\u4e14\u4e2d\u65ad\u7a0b\u5e8f<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10)\"><code>#if __STDC_VERSION__ != 201112L\n#error Not C11\n\/\/ \u4e0b\u9762\u662f\u7f16\u8bd1\u6548\u679c\n$gcc newish.c\nnewish.c:14.2: error: #error Not C11\ngcc newish.c -std=c11\n$\u6210\u529f\u8fd0\u884c<\/code><\/pre>\n\n\n\n<p><strong>#pragma\u7f16\u8bd1\u6307\u793a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px;border-radius:10px;padding-top:var(--wp--preset--spacing--10);padding-right:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--10);line-height:1.5\"><code>#pragma c9x on  \/\/ \u8ba9\u7f16\u8bd1\u5668\u652f\u6301C9X<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u5355\u793a\u4f8b \u660e\u793a\u5e38\u91cf#define \u5b8f\u5b9a\u4e49\u4ec5\u8fdb\u884c\u66ff\u6362, \u4e0d\u4f1a\u6c42\u503c, \u4e0d\u4f1a\u6c42\u503c, \u4e0d\u4f1a\u6c42\u503c &#8230;\u548c__V [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/comments?post=30"}],"version-history":[{"count":2,"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/posts\/30\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/posts\/30\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/media?parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/categories?post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xieg.top\/index.php\/wp-json\/wp\/v2\/tags?post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}