ClangãGCCããã³Microsoftã®ã³ã³ãã€ã©ãšåããããæçããCããã³C ++ã³ã³ãã€ã©ã§ããããšã蚌æãããŸããããClangãç¹å¥ãªã®ã¯ããããåãªãã³ã³ãã€ã©ã§ã¯ãªãããšã§ãã ããã¯ãããŒã«ãäœæããããã®ã€ã³ãã©ã¹ãã©ã¯ãã£ã§ãã ãã®ã¢ãŒããã¯ãã£ã¯ã©ã€ãã©ãªã®äœ¿çšã«åºã¥ããŠããããããããžã§ã¯ããžã®æ©èœã®åå©çšãšçµ±åãããã·ã³ãã«ã§æè»ã«ãªããŸãã
ã¯ã©ã³æ§é
ä»ã®å€ãã®ã³ã³ãã€ã©ãšåæ§ã«ãClangã«ã¯3ã€ã®ãã§ãŒãºããããŸãã
ãœãŒã¹ã³ãŒãã解æãããšã©ãŒããã§ãã¯ããå ¥åã³ãŒããè¡šãèšèªäŸåã®æœè±¡æ§æããªãŒïŒASTïŒãæ§ç¯ããããã³ããšã³ãã
ãªããã£ãã€ã¶ãŒïŒãã®ç®çã¯ãããã³ããšã³ãã«ãã£ãŠçæãããASTãæé©åããããšã§ãã
ããã¯ãšã³ãïŒã¿ãŒã²ãããã·ã³ã«å¿ããŠããã·ã³ã«ãã£ãŠå®è¡ãããæçµã³ãŒããçæããŸãã
Clangãšä»ã®ã³ã³ãã€ã©ã®éãã¯äœã§ããïŒ
æ倧ã®éãã¯ãClangã¯LLVMã«åºã¥ããŠãããLLVMã®äž»ãªã¢ã€ãã¢ã¯äžéè¡šçŸïŒIRïŒã䜿çšããããšã§ããããã¯Javaã®ãã€ãã³ãŒãã®äžçš®ã§ãã
LLVM IRã¯ãã³ã³ãã€ã©ãŒã®æé©å段éã«ããåæãšå€æã®äžé段éããµããŒãããããã«èšèšãããŠããŸãã ã軜éãã©ã³ã¿ã€ã æé©åã®ãµããŒããæç¶ãé/æ©èœéã®æé©åãããã°ã©ã å šäœã®åæãç©æ¥µçãªæ§é å€æãªã©ãå€ãã®ç¹å®ã®èŠä»¶ãèæ ®ããŠéçºãããŸããã ãã ããæãéèŠãªåŽé¢ã¯ãäžéè¡šçŸèªäœãæ確ã«å®çŸ©ãããã»ãã³ãã£ã¯ã¹ãæã€äžæµã®èšèªã§ããããšã§ãã
ãã®æ§é ã«ãããã»ãšãã©ã®ã³ã³ãã€ã©ãåå©çšããŠä»ã®ã³ã³ãã€ã©ãäœæã§ããŸããããšãã°ãããã³ããšã³ãã眮ãæããŠä»ã®èšèªããµããŒãã§ããŸãã
ãã®åŒ·åãªããã¡ãã®äžã«å ¥ãããããã©ã®ããã«èšèšããã³å®è£ ãããŠããããèŠãã®ã¯éåžžã«èå³æ·±ãã§ãã C ++éçºè ã¯ããã®ã³ãŒãããŒã¹ããå€ãã®åªããå®è·µãåŠã¶ããšãã§ããŸãã
CppDependãšCQLinqã䜿çšããŠãœãŒã¹ã³ãŒããXç·æ®åœ±ããéçºè ã®æ±ºå®äºé ãç解ããŸãããã
1.ã¢ãžã¥ãŒã«æ§
1.1ã ã¢ãžã¥ãŒã«æ§ãšã©ã€ãã©ãªã®äœ¿çš
clangã®éçºã«ãããäž»ãªæŠå¿µã¯ãã©ã€ãã©ãªã®äœ¿çšã§ãã ããã³ããšã³ãã®ããŸããŸãªéšåã¯ãããŸããŸãªç®çã§å ±æã§ããããŸããŸãªã©ã€ãã©ãªã«æ瀺çã«åå²ã§ããŸãã ãã®ã¢ãããŒãã«ãããåªããã€ã³ã¿ãŒãã§ã€ã¹ã®äœ¿çšãä¿é²ãããæ°ããéçºè ãã¿ã¹ã¯ãç°¡åã«è¡ããããã«ãªããŸãïŒå šäœåã®ããäžéšããç解ããå¿ èŠããªãããïŒã
äŸåé¢ä¿æ§é ãããªãã¯ã¹ã§ããDSMïŒDependency Structure MatrixïŒã¯ãã³ã³ããŒãã³ãéã®äŸåé¢ä¿ãè¡šãã³ã³ãã¯ããªæ¹æ³ã§ãã 空ã§ãªãè¡åã»ã«ã«ã¯æ°å€ãå«ãŸããŠããŸãã ãã®æ°å€ã¯ãã»ã«ã§è¡šãããçµå匷床ãè¡šããŸãã é¢ä¿ã®åŒ·ãã¯ãé¢ä¿ã«å«ãŸããã¡ã³ããŒ/ã¡ãœãã/ãã£ãŒã«ã/ã¿ã€ãããã³åå空éã®æ°ãšããŠè¡šãããšãã§ããŸãã
ãã®äŸåé¢ä¿ã°ã©ãã¯ãclangãçŽæ¥äœ¿çšããã©ã€ãã©ãªã瀺ããŠããŸãã
ã芧ã®ãšãããclangBasic / clangFrontEndãclangBasic / clangDriverãclangBasic / clangLexã©ã€ãã©ãªã®éã«3ã€ã®åŸªç°äŸåé¢ä¿ããããŸãã ã³ãŒããèªã¿ããããä¿å®ããããããã«ãã©ã€ãã©ãªéã®åŸªç°äŸåé¢ä¿ãåé€ããããšããå§ãããŸãã
clangFrontendãclangBasicã©ã€ãã©ãªã䜿çšããŠããã®ã¯ãªãã§ããïŒ
1ã€ã®åæãã£ãŒã«ãã®ã¿ã埪ç°äŸåé¢ä¿ãåŒãèµ·ãããã³ãŒãããªãã¡ã¯ã¿ãªã³ã°ã§ããäŸåé¢ä¿ãç°¡åã«ä¿®æ£ã§ããŸãã
1-2åå空éã䜿çšããã¢ãžã¥ãŒã«æ§
C ++ã§ã¯ãåå空éã¯ã³ãŒããã¢ãžã¥ãŒã«åããããã«äœ¿çšãããLLVM / clangã§ã¯3ã€ã®äž»ãªçç±ã§äœ¿çšãããŸãã
次ã®CQLinqã¯ãšãªã«ç€ºãããã«ãå€ãã®åå空éã«ã¯åæã®ã¿ãå«ãŸããŠããŸãã
倧èŠæš¡ãªãããžã§ã¯ãã§ã¯ã2ã€ã®ç°ãªãåæã«åãååãä»ããããªãããšã¯ä¿èšŒã§ããŸããã ãã®åé¡ã¯ãåæå€ãšãšãã«åæå€ã䜿çšããããšãæ瀺ããåæã¯ã©ã¹ã䜿çšããŠãC ++ 11ã§è§£æ±ºãããŸããã ã³ãŒãã¯ãC ++ 11åæã¯ã©ã¹ã䜿çšããŠè¿ãå°æ¥ãªãã¡ã¯ã¿ãªã³ã°ãããå¯èœæ§ããããŸãã
å¿åã®åå空éïŒååã®ãªãåå空éãã°ããŒãã«ãªéçå€æ°ã®äœæãåé¿ããŸãã äœæããå¿ååå空éã¯ãäœæããããã¡ã€ã«ã§ã®ã¿äœ¿çšã§ããŸãã 以äžã¯ã䜿çšãããŠãããã¹ãŠã®å¿ååå空éã®ãªã¹ãã§ãã
ãã¹ãŠã®éå¿ååå空éïŒ
åå空éã¯ãã¢ããªã±ãŒã·ã§ã³ãã¢ãžã¥ãŒã«åããããã®åªãããœãªã¥ãŒã·ã§ã³ã§ããLLVM/ clangã¯ã500以äžã®åå空éãå®çŸ©ããŠãã³ãŒããèªã¿ãããä¿å®ããããããã«ããã¢ãžã¥ãŒã«æ§ãæäŸããŸãã
2.ãã©ãã€ã ã®äœ¿çš
C ++ã¯åãªããªããžã§ã¯ãæåèšèªã§ã¯ãããŸããã Bjarn Straustrupã¯ãC ++ã¯ãã«ããã©ãã€ã èšèªã§ããããšãææããŸããã å€ãã®ããã°ã©ãã³ã°ã¹ã¿ã€ã«ãŸãã¯ãã©ãã€ã ããµããŒããããªããžã§ã¯ãæåã¯ãããã®1ã€ã«ãããŸããã ãã®ä»ã¯ãæç¶ãåããã°ã©ãã³ã°ãšæ±çšããã°ã©ãã³ã°ã§ãã
2.1ã æç¶ãåããã°ã©ãã³ã°
2.1.1ã ã°ããŒãã«æ©èœ
LLVM / ClangãœãŒã¹ã§å®çŸ©ãããŠãããã¹ãŠã®ã°ããŒãã«é¢æ°ãæ€çŽ¢ããŸãã
ãããã®æ©èœã¯3ã€ã®ã«ããŽãªã«åé¡ã§ããŸãã
1-ãŠãŒãã£ãªãã£ïŒããšãã°ãããã¿ã€ãããå¥ã®ã¿ã€ããžã®å€æé¢æ°ã
2-æŒç®åïŒCQLinqã®çµæã瀺ãããã«ãå€ãã®æŒç®åãå®çŸ©ãããŠããŸãïŒ
llvm / clangãœãŒã¹ã³ãŒãã§ã¯ãã»ãšãã©ãã¹ãŠã®ãªãŒããŒã©ã€ããããæŒç®åãèŠã€ãããŸãã
3-ã³ã³ãã€ã©ããžãã¯ã«é¢é£ããé¢æ°ïŒã³ã³ãã€ã©ã®ããŸããŸãªæ©èœãå®è£ ããå€ãã®ã°ããŒãã«é¢æ°ã
ããããããã®ã¿ã€ãã®é¢æ°ã¯ãéçã¯ã©ã¹ã¡ãœãããªã©ã®ã«ããŽãªã«ã°ã«ãŒãåããããåå空éã§ã°ã«ãŒãåããå¿ èŠããããŸãã
2.1.2ã éçã°ããŒãã«é¢æ°
ã°ããŒãã«é¢æ°ãéçãšããŠå®£èšããããšããå§ãããŸãããã ããå¥ã®ãœãŒã¹ãã¡ã€ã«ããåŒã³åºãå¿ èŠãããç¹å®ã®å Žåãé€ããŸãã
ã»ãšãã©ãã¹ãŠã®ã°ããŒãã«é¢æ°ã¯éçãšããŠå®£èšãããŠããŸãã
2.1.3ã ã°ããŒãã«é¢æ°-éçã®åè£
å¿ååå空éã§å®£èšãããŠãããã宣èšããããã¡ã€ã«ã®å€éšã®ã¡ãœããã§äœ¿çšãããŠããªãã°ããŒãã«ãªãšã¯ã¹ããŒãäžå¯èœãªé¢æ°ã¯ãéçé¢æ°ãžã®ãªãã¡ã¯ã¿ãªã³ã°ã«é©ããŠããŸãã
ã芧ã®ãšãããéçé¢æ°ã«ãªãã¡ã¯ã¿ãªã³ã°ã§ããé¢æ°ã¯ãããã§ãã
2.2ã ãªããžã§ã¯ãæåã®ãã©ãã€ã
2.2.1ã ç¶æ¿
ãªããžã§ã¯ãæåããã°ã©ãã³ã°ïŒOOPïŒã§ã¯ãç¶æ¿ã¯ãªããžã§ã¯ãéã®ãisãé¢ä¿ã確ç«ããæ¹æ³ã§ãã å€ãã®å Žåãæ¢åã®ã³ãŒããåå©çšããæ¹æ³ãšæ··åãããŸãããå®è£ ãåå©çšããããã®ç¶æ¿ã¯åŒ·åãªé¢ä¿ããããããããè¯ãæ¹æ³ã§ã¯ãããŸããã ã³ãŒãã®åå©çšæ§ã¯ãæ§æã«ãã£ãŠå®çŸãããŸãïŒæ§æã¯ç¶æ¿ãããæãŸããïŒã å°ãªããšã1ã€ã®åºæ¬ã¯ã©ã¹ãæã€ãã¹ãŠã®ã¯ã©ã¹ãæ¢ããŸãããã
ãã®ã¯ãšãªã§ã¯ã¡ããªãã¯ãã¥ãŒã䜿çšããããšããå§ãããŸãã
ã¡ããªãã¯ãã¥ãŒã§ã¯ãã³ãŒãããŒã¹ã¯ããªãŒããããšããŠè¡šãããŸãã ããã¯ããã¹ããããé·æ¹åœ¢ã䜿çšããŠããªãŒã®ãããªããŒã¿æ§é ã衚瀺ããæ¹æ³ã§ãã CppDependã§äœ¿çšãããããªãŒæ§é ã¯ãéåžžã®ã³ãŒãéå±€ã§ãã
ãããžã§ã¯ãã«ã¯åå空éãå«ãŸããŸãã
åå空éã«ã¯ã¿ã€ããå«ãŸããŸãã
ã¿ã€ãã«ã¯ã¡ãœãããšãã£ãŒã«ããå«ãŸããŸãã
ããªãŒãããã¯ãCQLinqã¯ãšãªçµæã衚瀺ãã䟿å©ãªæ¹æ³ã§ããéãé·æ¹åœ¢ã¯çµæãè¡šããã¯ãšãªã«é¢é£ä»ããããã¿ã€ãã確èªã§ããŸãã
ã芧ã®ãšãããç¶æ¿ã¯llvm / clangãœãŒã¹ã³ãŒãã§åºã䜿çšãããŠããŸãã
å€éç¶æ¿ïŒè€æ°ã®ã¯ã©ã¹ããç¶æ¿ãããã¯ã©ã¹ãèŠã€ããŸãããã
å€éç¶æ¿ã¯ãã£ãã«äœ¿çšããããã¯ã©ã¹ã®1ïŒ æªæºãè€æ°ã®ã¯ã©ã¹ããç¶æ¿ãããŸãã
2.2.2ã ä»®æ³ã¡ãœãã
ãœãŒã¹ã³ãŒãã§å®çŸ©ãããŠãããã¹ãŠã®ä»®æ³ã¡ãœãããèŠã€ããŸãããã
å€ãã®ã¡ãœããã¯ä»®æ³ã§ããããã®ãã¡ã®ããã€ãã¯çŽç²ãªä»®æ³ã§ãïŒ
OOPãã©ãã€ã ã¯ãllvm / clangãœãŒã¹ã³ãŒãã§åºã䜿çšãããŠããŸãã äžè¬åãããããã°ã©ãã³ã°ã¯ã©ãã§ããïŒ
2.3ã äžè¬çãªããã°ã©ãã³ã°
C ++ã¯ãäžè¬åãããããã°ã©ãã³ã°ã®ã¢ã€ãã¢ããã³ãã¬ãŒãã§è¡šçŸãããŠããŒã¯ãªæ©äŒãæäŸããŸãã ãã¿ãŒã³ã¯ãäžè¬åãããã¢ã«ãŽãªãºã ãšããŒã¿æ§é ãè¡šçŸã§ãããã©ã¡ããªãã¯å€åã®äžåœ¢æ ã§ãã C ++ãã³ãã¬ãŒãã®ã€ã³ã¹ã¿ã³ã¹åã¡ã«ããºã ã«ãããäžè¬åãããã¢ã«ãŽãªãºã ãšããŒã¿æ§é ã䜿çšããããšãç¹å®ã®ãã©ã¡ãŒã¿ãŒå°çšã«å®å šã«æé©åãããç¹æ®ãªããŒãžã§ã³ãäœæãããäžè¬åãããã¢ã«ãŽãªãºã ãéäžè¬åããŒãžã§ã³ãšåããããå¹ççã«ãªããŸãã
2.3.1ã ãžã§ããªãã¯å
ãœãŒã¹ã³ãŒãã§å®çŸ©ãããŠãããã¹ãŠã®ãžã§ããªãã¯åãèŠã€ããŸãããã
å€ãã®ã¿ã€ãã¯äžè¬åããããã®ãšããŠå®çŸ©ãããŠããŸãã äžè¬åãããã¡ãœãããèŠã€ããŸãããïŒ
ã¡ãœããã®1ïŒ æªæºãäžè¬åãããŠããŸã
ãããã£ãŠãllvm / clangã®ãœãŒã¹ã³ãŒãã¯3ã€ã®ãã©ãã€ã ã䜿çšããŸãã
3. PODã¯ããŒã¿ã¢ãã«ãå®çŸ©ããŸã
ãªããžã§ã¯ãæåããã°ã©ãã³ã°ã§ã¯ãPlain Old DataïŒPODïŒã¯ããªããžã§ã¯ãæåé¢æ°ã䜿çšããã«ãå€ã®ååçãªã³ã¬ã¯ã·ã§ã³ã®ã¿ãè¡šãããŒã¿æ§é ã§ãã ã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ã§ã¯ãããã·ãããŒã¿æ§é ãšãåŒã°ããŸãã
ãœãŒã¹ã³ãŒãã§PODã¿ã€ããæ¢ããŸãããã
1,500ãè¶ ããã¿ã€ããPODã¿ã€ããšããŠå®çŸ©ããããã®å€ãã¯ã³ã³ãã€ã©ããŒã¿ã¢ãã«ã®å®çŸ©ã«äœ¿çšãããŸãã
4. 4人ã®ã®ã£ã³ã°ãèšèšãããã¿ãŒã³
èšèšãã¿ãŒã³ã¯ããœãããŠã§ã¢èšèšã®äžè¬çãªåé¡ã®è§£æ±ºçã説æãããœãããŠã§ã¢ãšã³ãžãã¢ãªã³ã°ã®æŠå¿µã§ãã Gang of Fourãã¿ãŒã³ãæã人æ°ããããŸãã llvm / clangãœãŒã¹ã³ãŒãã§ãããã®äœ¿çšæ³ãèŠã€ããŸãããã
4.1ã å·¥å Ž
ãœãŒã¹ã³ãŒãã§å®çŸ©ãããŠãããã¡ã¯ããªã¡ãœããã®ãªã¹ãïŒ
æœè±¡ãã¡ã¯ããªãŒã¡ãœããã®ãªã¹ãïŒ
4.2ã ãªãã¶ãŒããŒ
ãªãã¶ãŒããŒãã¿ãŒã³ã¯ããªããžã§ã¯ãã«ãªãã¶ãŒããŒãªããžã§ã¯ãã®ãªã¹ããå«ãŸããéåžžã¯ã¡ãœããã®1ã€ãåŒã³åºãããšã«ãããç¶æ ã®å€åãèªåçã«éç¥ãããã¶ã€ã³ãã¿ãŒã³ã§ãã
ãœãŒã¹ããã¹ãã«ã¯1人ã®ãªãã¶ãŒããŒãããããŸããã
4.3ã 蚪åè
蚪åè ãã¿ãŒã³ã¯ãæ§é ãæ©ãåããæ§é ã®åããŒãã§ç¹å®ã®ã¢ã¯ã·ã§ã³ãå®è¡ããå¿ èŠãããå Žåã«æšå¥šãããŸãã
llvm / clangãœãŒã¹ã³ãŒãã§ã¯ã蚪åè ãã¿ãŒã³ãåºã䜿çšãããŠããŸãã
5.ã«ãããªã³ã°ãšåé
5.1ã ã¯ã©ãã
ã¢ããªã±ãŒã·ã§ã³ã®äžéšãå€æŽããã ãã§ãã¢ããªã±ãŒã·ã§ã³ã®æ®ãã®éšåãå€æŽããå¿ èŠãå°ãªããªããããäœãå¯ç床ãæãŸããã§ãã é·ãç®ã§èŠãã°ãããã«ãããæ°ããæ©èœãã¢ããªã±ãŒã·ã§ã³ã«å€æŽãããè¿œå ãããããããšã«é¢é£ããæéãåŽåãè²»çšãå€§å¹ ã«ç¯çŽã§ããŸãã
æœè±¡ã¯ã©ã¹ã䜿çšãããããžã§ããªãã¯åããã³ã¡ãœããã䜿çšããŠãäœåºŠã®çµåãå®çŸã§ããŸãã
ãœãŒã¹ã³ãŒãã§å®çŸ©ãããŠãããã¹ãŠã®æœè±¡ã¯ã©ã¹ãèŠã€ããŸãããã
280ãè¶ ããåãæœè±¡ãšããŠå®£èšãããŠããŸãã ãã ããäžè¬çãªã¿ã€ããšäžè¬çãªæ¹æ³ã䜿çšããããšã§ãäœãæ¥ç床ãéæãããŠããŸãã
æ¥ç¶æ§
åäžè²¬ä»»ã®ååã§ã¯ãã¯ã©ã¹ã«ã¯è€æ°ã®å€æŽçç±ãå«ããããšã¯ã§ããŸããã ãã®ãããªã¯ã©ã¹ã¯æ¥ç¶ãšåŒã°ããŸãã LCOMå€ãé«ãå Žåãã»ãšãã©ã®å Žåãæ¥ç¶ãäžååãªã¯ã©ã¹ã«å¯Ÿå¿ããŠããŸãã ããã€ãã®LCOMã¡ããªãã¯ããããŸãã LCOMã¯[0-1]ã®ç¯å²ã®å€ãåããŸãã LCOM HSïŒHSã¯Henderson-Sellersã®ç¥ïŒã¯[0-2]ã®ç¯å²ã®å€ãåããŸãã LCOM HSã®å€ã1ãã倧ããå ŽåãèŠåãããã¯ãã§ãã LCOMã¡ããªãã¯ã¯æ¬¡ã®ããã«ã«ãŠã³ããããŸãã
LCOM = 1-ïŒåèšïŒMFïŒ/ M * FïŒ
LCOM HS =ïŒM-åèšïŒMFïŒ/ FïŒïŒM-1ïŒ
ããã§ïŒ
Mã¯ãã¯ã©ã¹ã¡ãœããã®æ°ã§ãïŒéçã¡ãœãããã³ã³ã¹ãã©ã¯ã¿ãŒãã²ãã¿ãŒ/ã»ãã¿ãŒãã€ãã³ããè¿œå ããã³åé€ããããã®ã¡ãœãããã«ãŠã³ãããŸãïŒã
Fã¯ãã¯ã©ã¹ã®ééçãã£ãŒã«ãã®æ°ã§ãã
MF-ç¹å®ã®ééçãã£ãŒã«ãã«ã¢ã¯ã»ã¹ã§ããã¯ã©ã¹ã¡ãœããã®æ°ã
SumïŒMFïŒ-ã¯ã©ã¹ã®ãã¹ãŠã®ééçãã£ãŒã«ãã®MFã®åèšã
ãã®åŒã§è¡šãããã¢ã€ãã¢ã¯æ¬¡ã®ããã«å®åŒåã§ããŸãïŒãã¹ãŠã®ã¡ãœããããã¹ãŠã®ééçãã£ãŒã«ãã䜿çšããå Žåã®æ¥ç¶ã¯ã©ã¹ãã€ãŸãåèšïŒMFïŒ= M * Fããããã£ãŠLCOM = 0ããã³LCOMHS = 0
235ã®ã¯ã©ã¹ãã¬ãã¥ãŒããŸãããããããããããã®ããã€ãã¯ãªãã¡ã¯ã¿ãªã³ã°ããŠæ¥ç¶æ§ãæ¹åã§ããŸãã
6.å ç«åãçŽåºŠããã³å¯äœçš
6.1ã äžå€ã®å
ãªããžã§ã¯ãã¯ãäœæãããæç¹ããç¶æ ãå€ãããªãå Žåãäžå€ãšåŒã°ããŸãã ãããã£ãŠãã€ã³ã¹ã¿ã³ã¹ãäžå€ã§ããå Žåãã¯ã©ã¹ã¯äžå€ãšåŒã°ããŸãã
äžå€ãªããžã§ã¯ãã®äœ¿çšãæ¯æããè°è«ã1ã€ãããŸãã競åããããã°ã©ãã³ã°ãå€§å¹ ã«ç°¡çŽ åããŸãã ãã«ãã¹ã¬ããããã°ã©ãã³ã°ã®æžã蟌ã¿æäœãéåžžã«è€éãªçç±ãèããŠãã ããã ã¹ã¬ããã®ãªãœãŒã¹ïŒãªããžã§ã¯ããŸãã¯ä»ã®OSãªãœãŒã¹ïŒãžã®ã¢ã¯ã»ã¹ãåæããããšã¯é£ããããã§ãã ã¢ã¯ã»ã¹ãåæããããšãé£ããã®ã¯ãªãã§ããïŒ è€æ°ã®ã¹ããªãŒã éã§ç«¶åãçºçããªãããšãä¿èšŒããã®ã¯é£ããããã§ãã æžã蟌ã¿ã¢ã¯ã»ã¹ããªãå Žåã¯ã©ããªããŸããïŒ èšãæããã°ãã¹ã¬ãããã¢ã¯ã»ã¹ã§ãããªããžã§ã¯ãã®ç¶æ ãå€ãããªãå Žåã¯ã©ãã§ããããïŒ ãã®åŸãåæã®å¿ èŠã¯ãããŸããã
äžå€ã¯ã©ã¹ã®ãã1ã€ã®å©ç¹ã¯ãããããLisk眮æã®ååã«æ±ºããŠéåããªãããšã§ããWikipediaã®Liskååã®å®çŸ©ã¯æ¬¡ã®ãšããã§ãã
ã ãµãã¯ã©ã¹ã¯ãåºæ¬ã¯ã©ã¹ã®ããããã£ã®æ°ãããã¥ãŒããŒã¿ãŒãäœæããªãã§ãã ãããåºæ¬ã¯ã©ã¹ã§å®çŸ©ãããããããã£ãå€æŽããã¡ãœãããæäŸããªãã£ãå Žåããã®ã¯ã©ã¹ã®ãµãã¿ã€ãããã®ãããªã¡ãœãããäœæããŸãããã€ãŸããåºæ¬ã¯ã©ã¹ã®äžå€ããŒã¿ã¯ãµãã¯ã©ã¹ã§å€æŽã§ããŸããã ã
ãœãŒã¹ã³ãŒãå ã®äžå€åã®ãªã¹ãã次ã«ç€ºããŸãã
6.2ã çŽåºŠãšå¯äœçš
äžå€ã®åã®äž»ãªå©ç¹ã¯ãå¯äœçšãæé€ãããšããäºå®ã«ãããŸãã ããã«ã€ããŠã¯ãŠã§ã¹ã»ãã€ã¢ãŒä»¥äžã«èªãããšã¯ã§ããŸããã
ãç§ãã¡ã¯çãã°ããŒãã«å€æ°ã䜿çšããã®ã¯è¯ãèãã§ã¯ãªãããšãç¥ã£ãŠããŸãã ããã¯ãå¯äœçšã®å±éºæ§ã«ãããã®ã§ãïŒã°ããŒãã«ã¹ã³ãŒãïŒã ã°ããŒãã«å€æ°ã䜿çšããªãå€ãã®ããã°ã©ããŒã¯ãåãåçãããéãããèŠæš¡ã§ãã£ãŒã«ããããããã£ããã©ã¡ãŒã¿ãŒãå€æ°ã«é©çšãããããšãç解ããŠããŸããïŒæ£åœãªçç±ãªãã«ããããå€æŽããªãã§ãã ããïŒ...ïŒ "
ã¢ãžã¥ãŒã«ã®ä¿¡é Œæ§ãé«ãã1ã€ã®æ¹æ³ã¯ãå¯äœçšãåãé€ãããšã§ãã ããã«ãããã¢ãžã¥ãŒã«ã®ã³ã³ãã€ã«ãšçµ±åãããç°¡åã§ä¿¡é Œæ§ã®é«ããã®ã«ãªããŸãã å¯äœçšããªãå Žåãç°å¢ã«é¢ä¿ãªãåžžã«åãããã«æ©èœããŸãã ããã¯ãåç §ééæ§ãšåŒã°ããŸãã
å¯äœçšã®ãªãé¢æ°ãšã¡ãœãããæžã-ãããã¯ãªããžã§ã¯ããå€æŽããªãçŽç²ãªé¢æ°ã§ã-ããã¯ããªãã®ããã°ã©ã ã®æ£ç¢ºããšããæå³ã§ããè¯ãã§ãããã
å¯äœçšã®ãªããã¹ãŠã®ã¡ãœããã®ãªã¹ãã¯æ¬¡ã®ãšããã§ãã
100,000ãè¶ ããã¡ãœãããã¯ãªãŒã³ã§ãã
7.å®è£ ã®å質
7.1ã 倧ããããæ¹æ³
å€ãã®ã³ãŒãè¡ãæã€ã¡ãœããã¯ãç¶æããã³ç解ãå°é£ã§ãã 60è¡ä»¥äžã®ã¡ãœãããèŠã€ããŸãããã
llvm / clangã®ãœãŒã¹ã³ãŒãã«ã¯100,000ãè¶ ããã¡ãœãããå«ãŸããŠããã2ïŒ æªæºã®ã¡ãœããã¯å€§ãããããšèŠãªãããšãã§ããŸãã
7.2ã å€ãã®ãã©ã¡ãŒã¿ãæã€ã¡ãœãã
ããã€ãã®ã¡ãœããã«ã¯8ã€ä»¥äžã®ãã©ã¡ãŒã¿ãŒããããŸãã
7.3ã å€ãã®ããŒã«ã«å€æ°ãæã€ã¡ãœãã
ã¡ãœããã®1ïŒ æªæºã«å€ãã®ããŒã«ã«å€æ°ããããŸãã
7.4ã è€éãããæ¹æ³
è€éãªæ©èœãæ€åºããã³ãŒãã®è¡æ°ããã©ã¡ãŒã¿ãŒã®æ°ãããŒã«ã«å€æ°ã®æ°ãèšç®ããããã®å€ãã®ã¡ããªãã¯ãååšããŸãã
è€éãªæ©èœãæ€åºããããã®èå³æ·±ãã¡ããªãã¯ããããŸãã
埪ç°çè€é床ã¯ãããã·ãŒãžã£ã§è¡ããã決å®ã®æ°ã«çããäžè¬çãªããã·ãŒãžã£ããã°ã©ãã³ã°ã¡ããªãã¯ã§ãã
ãã¹ããããæ·±ãã¯ãã¡ãœããæ¬äœã§å¯èŠé åã®ãã¹ãã®æ倧深ãã決å®ããã¡ãœããã«å¯ŸããŠå®çŸ©ãããã¡ããªãã¯ã§ãã
æ倧ãã¹ããµã€ã¯ã«ã
ãããã®ã¡ããªãã¯ã«èš±å¯ãããæ倧å€ã¯ãéçºããŒã ã®éžæã«ãã倧ããäŸåããäžè¬ã«åãå ¥ããããŠããæšæºã¯ãããŸããã
è€éã§ãããšèããããã¡ãœãããèŠã€ããŸãããã
è€éããæå°éã«æããããã®åè£ãšãªãã¡ãœããã¯ããã1.5ïŒ ã§ãã
7.5ã ãã«ã¹ãããã®é£ãã
Halstead Complexityã¯ã1977幎ã«Maurice Howard Halsteadã«ãã£ãŠå°å ¥ããããœãããŠã§ã¢ã¡ããªãã¯ã§ãã Halsteadã¯ããã©ãããã©ãŒã ã«é¢ä¿ãªããããã°ã©ã ã¡ããªãã¯ãããŸããŸãªèšèªã§ã®ã¢ã«ãŽãªãºã ã®å®è£ ãåæ ããå¿ èŠããããšãã芳å¯ãè¡ããŸããã ãããã®ã¡ããªãã¯ã¯ãã³ãŒãã«ãã£ãŠéçã«èšç®ãããŸãã
Halsteadã¯å€ãã®ç°ãªãã¡ããªãã¯ãå°å ¥ããŸãããããšãã°ããã®ãã¡ã®1ã€ã§ããTimeToImplementãæ€èšããŠãã ãããããã¯ãã¡ãœããã®ããã°ã©ãã³ã°ã«å¿ èŠãªæéãç§åäœã§ç€ºããŸãã
2690ã¡ãœããã®å®è£ ã«ã¯1æé以äžããããŸãã
8. RTTI
RTTIã¯ããªããžã§ã¯ãã®åçãªåãå ±åããå®è¡æã«ïŒããã³ã³ã³ãã€ã«æã«ã§ã¯ãªãïŒåæ å ±ãæäŸããã·ã¹ãã ã®æ©èœã§ãã ãã ããC ++ã³ãã¥ããã£ã§ã¯RTTIã®äœ¿çšã«ã€ããŠè°è«ã®äœå°ããããŸãã å€ãã®C ++éçºè ã¯ãã®ã¡ã«ããºã ã䜿çšããŸããã
llvm / clangéçºããŒã ã¯ã©ãã§ããïŒ
dynamic_castããŒã¯ãŒãã䜿çšããã¡ãœããã¯ãããŸããã llvm / clangéçºããŒã ã¯ãRTTIãšã³ãžã³ã䜿çšããªãããšãéžæããŸããã
9.äŸå€
äŸå€ãµããŒãã¯ãC ++ã®ãã1ã€ã®è°è«ã®äœå°ã®ããæ©èœã§ãã å€ãã®æåãªãªãŒãã³ãœãŒã¹C ++ãããžã§ã¯ãã§ã¯äœ¿çšãããŠããŸããã
ã³ãŒãã®ã©ããã«äŸå€ãã¹ããŒããããã©ããèŠãŠã¿ãŸãããã
RTTIãšåæ§ã«ãäŸå€ã¡ã«ããºã ã¯äœ¿çšãããŸããã
10.ããã€ãã®çµ±èš
10.1ã æã人æ°ã®ããã¿ã€ã
ãããžã§ã¯ãã§æã䜿çšãããŠããã¿ã€ããç¥ãããšã¯èå³æ·±ãã§ãããã®ãããªã¿ã€ãã¯ãæé©ã«èšèšãå®è£ ãããã³ãã¹ããããå¿ èŠãããããã§ãã ãããã®å€æŽã¯ããããžã§ã¯ãå šäœã«åœ±é¿ããŸãã
TypesUsingMeã¡ããªãã¯ã䜿çšããŠããããèŠã€ããŸãã
人æ°ã®ããåãèŠã€ããããã®å¥ã®èå³æ·±ãææšãTypeRankããããŸãã
TypeRankå€ã¯ãã¿ã€ãäŸåã°ã©ãã«Google PageRankã¢ã«ãŽãªãºã ãé©çšããããšã«ããèšç®ãããŸãã å¹³åTypeRankã1ã«çãããªãããã«ã0.15ã®äžå¿ãã¢ãžãã£ãé©çšãããŸãã
TypeRankãé«ãåã¯ããã°ãããæ²æšã«ãªãå¯èœæ§ããããããããæ éã«ãã¹ãããå¿ èŠããããŸãã
以äžã¯ãTypeRankã¡ããªãã¯ã«åºã¥ããã¹ãŠã®äžè¬çãªã¿ã€ãã®çµæã§ãã
10.2ã æãäžè¬çãªæ¹æ³
10.3ã ä»ã®å€ãã®ã¡ãœãããåŒã³åºãã¡ãœãã
ã©ã®ã¡ãœãããä»ã®å€ãã®ã¡ãœãããåŒã³åºãããç¥ãããšã¯èå³æ·±ãã§ã;ããã«ãããèšèšäžã®åé¡ãæããã«ãªããŸãã å Žåã«ãã£ãŠã¯ãèªã¿ãããä¿å®ããããããããã«ãªãã¡ã¯ã¿ãªã³ã°ãå¿ èŠã§ãã
ãŸãšã
LLVM / Clangã¯éåžžã«é©åã«èšèšããã³å®è£ ãããŠãããä»ã®ãããžã§ã¯ããšåæ§ã«ãäœããã®ãªãã¡ã¯ã¿ãªã³ã°ã«ãã£ãŠæ¹åã§ããŸãã ãã®æçš¿ã§ã¯ããœãŒã¹ã³ãŒãã§å¯èœãªæå°éã®å€æŽã®äžéšãæããã«ããŸããã ãœãŒã¹ã³ãŒããç 究ããC ++ã®ç¥èãåäžãããããšãæããªãã§ãã ããã