{"id":1589,"date":"2013-08-21T12:10:36","date_gmt":"2013-08-21T04:10:36","guid":{"rendered":"http:\/\/me.doucl.com\/?p=1589"},"modified":"2013-08-21T12:10:36","modified_gmt":"2013-08-21T04:10:36","slug":"programming-brace-style","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/other\/programming-brace-style.html","title":{"rendered":"\u7f16\u7a0b\u98ce\u683c\u4e4b\u82b1\u62ec\u53f7(\u5927\u62ec\u53f7)"},"content":{"rendered":"
\u4eca\u5929\u4e00\u540c\u4e8b\u63d0\u51fa\u7f16\u7a0b\u98ce\u683c\u7edf\u4e00\u95ee\u9898\uff0c\u521a\u597d\u63d0\u5230\u82b1\u62ec\u53f7(\u5927\u62ec\u53f7)\u662f\u5426\u5e94\u8be5\u53e6\u8d77\u6362\u884c\u7684\u95ee\u9898\u5f15\u8d77\u4e86\u5f02\u4e49\uff0c\u4e00\u8d77\u4ee5\u6765\u6211\u90fd\u91c7\u53d6\u7684\u662f\u76f4\u63a5\u53e6\u8d77\u4e00\u884c\u7684\u98ce\u683c\uff0c\u53ef\u80fd\u8ddf\u63a5\u89e6\u7684\u8bed\u8a00\u548c\u5de5\u5177\u6709\u5173\u5427\u3002\u63a5\u89e6\u7684\u6bd4\u8f83\u591a\u7684\u90fd\u662fLinux\u7c7b\u5f00\u6e90\u65b9\u6848\uff0c\u5165\u95e8\u4eceC\u5f00\u59cb\uff0c\u7136\u540e\u4e00\u76f4\u662f\u7528\u7684PHP\u505a\u4e3a\u4e3b\u8981\u5f00\u53d1\u8bed\u8a00\uff0c\u518d\u5c31\u662fJavaScript\u4e86\uff0c\u5176\u4ed6\u7684\u7528\u7684\u6bd4\u8f83\u5c11\u7684\u5c31\u662fObject\uff0dC\u548cPython\u4e86.<\/p>\n
\u76ee\u524d\u6d41\u884c\u7684\u5e94\u8be5\u4e3b\u8981\u662f\u4ee5\u4e0b\u4e24\u79cd\u98ce\u683c:<\/p>\n
\u98ce\u683c\u4e00\uff1a\u8d77\u9996\u7684\u5927\u62ec\u53f7\u53e6\u8d77\u4e00\u884c<\/p>\n
block
\n{
\n…….
\n}<\/p>\n
\u98ce\u683c\u4e8c\uff1a\u8d77\u9996\u7684\u5927\u62ec\u53f7\u8ddf\u5728\u5173\u952e\u5b57\u540e\u9762<\/p>\n
block{
\n… …
\n}<\/p>\n
\u6211\u4e00\u76f4\u91c7\u7528\u7684\u662f\u98ce\u683c\u4e00\uff0c\u8d77\u56e0\u662f\u6700\u65e9\u63a5\u89e6\u8bed\u8a00\u98ce\u683c\u7684\u662fLinux\u76f8\u5173\u7684\u8d44\u6599\uff0c\u63d0\u7684\u6bd4\u8f83\u591a\u7684\u5c31\u662fGNU\u8bed\u8a00\u98ce\u683c\uff0c\u4fe1\u5949\u7684\u7406\u7531\u4e5f\u5f88\u7b80\u5355\uff0c\u505a\u4e3a\u5f00\u6e90\u65b9\u5411\u7684\u7ae5\u978b\u6765\u8bb2\uff0cLinux\u5185\u6838\u5f00\u53d1\u9075\u5b88\u7684\u89c4\u8303\u201c\u4f60\u503c\u5f97\u62e5\u6709\u201d \ud83d\ude42 \uff0c\u5e94\u8be5C\u548cC++\u7684\u7ae5\u978b\u4e00\u822c\u90fd\u91c7\u7528\u8fd9\u79cd\u98ce\u683c\u7684\u6bd4\u8f83\u591a\uff0c\u5f53\u7136PHP\u4e5f\u6709\u5f88\u591a:)<\/p>\n
\u98ce\u683c\u4e8c\u4f20\u8bf4\u662fJava\u8bed\u8a00\u5f00\u53d1\u89c4\u8303\u7528\u7684\u6bd4\u8f83\u591a\u7684\uff0cK&R style<\/strong>\uff1fwho care?<\/p>\n \u4e4b\u524d\u4e00\u76f4\u4ee5\u4e3a\u4e24\u79cd\u98ce\u683c\u6ca1\u6709\u539f\u5219\u4e0a\u7684\u5dee\u5f02\uff0c\u65e0\u975e\u5c31\u662f\u4e60\u60ef\u4e0e\u98ce\u683c\u7f62\u4e86\uff0c\u8fd9\u4e4b\u524d\u6211\u4e5f\u4e00\u76f4\u9519\u8bef\u5730\u8fd9\u6837\u4ee5\u4e3a.<\/p>\n \u6709\u4e9b\u8bed\u8a00\u5176\u5b9e\u8fd8\u662f\u5fc5\u987b\u8981\u91c7\u7528\u67d0\u79cd\u98ce\u683c\u7684\uff0c\u6bd4\u5982JavaScript\uff0c\u5fc5\u987b\u91c7\u7528\u98ce\u683c\u4e8c\uff0c\u7406\u7531\u5982\u4e0b\uff1a<\/p>\n \u56e0\u4e3aJavaScript\u4f1a\u81ea\u52a8\u6dfb\u52a0\u53e5\u672b\u5206\u53f7\uff0c\u5982\u679c\u91c7\u7528\u98ce\u683c\u4e00\uff0c\u5927\u62ec\u53f7\u53e6\u8d77\u4e00\u884c\u7684\u8bdd\u4f1a\u4ea7\u751f\u4e00\u4e9b\u96be\u4ee5\u5bdf\u89c9\u7684\u9519\u8bef.<\/p>\n return \u4ee5\u4e0a\u4ee3\u7801\u539f\u4e49\u662f\u8981\u8fd4\u56de\u4e00\u4e2a\u5bf9\u8c61\uff0c\u5b9e\u9645\u4e0a\u8fd4\u56de\u7684\u662fundefined,\u56e0\u4e3aJavaScript\u4f1a\u5728return\u540e\u9762\u81ea\u52a8 \u6dfb\u52a0\u4e00\u4e2a\u5206\u53f7.\u6b63\u786e\u7684\u4ee3\u7801\u5e94\u8be5\u5199\u6210\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n return{ \u5176\u4ed6\u8bed\u8a00\u8fd8\u6709\u4ec0\u4e48\u533a\u522b\u7684\u6b22\u8fce\u8865\u5145 \ud83d\ude42<\/p>\n <\/p>\n \u5f15\u7528\u8d44\u6599\uff1a<\/strong><\/p>\n http:\/\/en.wikipedia.org\/wiki\/Indent_style<\/a><\/p>\n http:\/\/www.zhihu.com\/question\/19742466<\/a><\/p>\n http:\/\/www.gnu.org\/prep\/standards\/html_node\/Formatting.html<\/a><\/p>\n
\n{
\nkey:value;
\n};<\/p>\n
\nkey:value;
\n};<\/p>\n