C++ ?????????????о?
????????? ???????[ 2016/10/31 11:44:06 ] ????????.NET C++
?????????Google C++ ??????????????
????????????б???淶???????????????á?Google C++ ??????????????С?Google C++ ??????????????????????????????????
????Names and Order of Includes
????link ?Use standard order for readability and to avoid hidden dependencies:C library?? C++ library?? other libraries’ .h?? your project’s .h.
????All of a project’s header files should belisted as descendants of the project’s source directory without use of UNIXdirectory shortcuts . (the current directory) or .. (the parent directory). Forexample?? google-awesome-project/src/base/logging.h should be included as
????#include “base/logging.h”
????In dir/foo.cc or dir/foo_test.cc?? whosemain purpose is to implement or test the stuff in dir2/foo2.h?? order yourincludes as follows:
????dir2/foo2.h (preferred location — seedetails below).
????C system files.
????C++ system files.
????Other libraries’ .h files.
????Your project’s .h files.
????The preferred ordering reduces hiddendependencies. We want every header file to be compilable on its own. Theeasiest way to achieve this is to make sure that every one of them is the first.h file #included in some .cc.
????dir/foo.cc and dir2/foo2.h are often in thesame directory (e.g. base/basictypes_test.cc and base/basictypes.h)?? but can bein different directories too.
????Within each section it is nice to order theincludes alphabetically.
????For example?? the includes ingoogle-awesome-project/src/foo/internal/fooserver.cc might look like this:
#include "foo/public/fooserver.h" // Preferred location.
#include <sys/types.h>
#include <unistd.h>
#include <hash_map>
#include <vector>
#include "base/basictypes.h"
#include"base/commandlineflags.h"
#include "foo/public/bar.h"
????????????????????????????粻??????????λ?????????
????1. ????????????????????????????????????C?????C++????????????????????????????????????????????????????????????????a.cpp???????????????a.h?????????????????????????????????????????????????????????????????????????cc?????linux????cpp???????cc????google-awesome-project/src/foo/internal/fooserver.cc???????????????????????????£?
????#include <sys/types.h>
????#include <unistd.h>
????#include <hash_map>
????#include <vector>
????#include "base/basictypes.h"
????#include "base/commandlineflags.h"
????#include "foo/public/bar.h"
????2. ????????????ü?????????????????????????????????????????????base???????????logging.h?????????????????????????д??
????#include “base/logging.h”????????#include “logging.h”
???????????????????Google C++ ???????????????????????????????
????1. ???????????????????????????????????????????????????????????????
????2. ???????????????????????????????????á?Google C++ ??????????????C?????C++??????????????????????????????????????????????????????????????????????????sys/types.h??????????C?????????Linux??????????SDK?ɡ???????????????????????OS SDK .h ?? C?????C++??????????????????????????????????
????3.???????????????????????г?????????????????????????????????????С???????????????
??????????C++???????е??????
??????Google C++ ???????????????????C++??????????????????????C++??????P432????
??????????????????????“???????”?????????????????κ??????????????????????????????????“????”????????????????????????????????C++????????C????????
??????????????????JohnLakos???Large ScaleC++ Softwre Design??(????????????????????C++????????)?е???λ???
???????.h?????????????????????????parse???????????????????????????????????????????????????塣??.c????????а???.h ???????????ж???????????????????????????鶼??.h?У???????????????Щ????飬??????????.c????????????????????
??????????????????????“?????????”?????????????????????????????????????????????????鷳???鷢????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11