C ++ ceev npaum li cas?
C ++ ceev npaum li cas?

Video: C ++ ceev npaum li cas?

Video: C ++ ceev npaum li cas?
Video: Tus Tseem Poj Laib Ces Yog Kuv | Npauj Nyiag Yaj | Ma Ya | Official MV 2023 2024, Hlis ntuj nqeg
Anonim

Yog li, nyob ntawm qhov kev xeem, C++ tuaj yeem nyob ib ncig ntawm 30% qeeb dua li C (los yog phem dua yog tias koj ua raws li qhov txuas) tab sis idiomatic C++ yog 30% sai dua nyob rau hauv feem ntau thiab muaj peev xwm mus txog 6x ceev tshaj C . Keeb Kwm Teb: Qhov twg yog sai dua , C los yog C++?

Xav txog qhov no, vim li cas C sai dua C ++?

C ceev tshaj C ++ C++ tso cai rau koj sau abstractions uas compile-down kom sib npaug C . Qhov no txhais tau tias nrog qee qhov kev saib xyuas, a C++ qhov kev pab cuam yuav tsawg kawg yog ceev li a C ib. C++ muab cov cuab yeej rau koj encode koj lub siab nyiam hauv hom-system. Qhov no tso cai rau lub compiler los tsim kom pom binaries los ntawm koj cov cai.

Ib yam li ntawd, puas muaj hom lus sai dua C? Fortran yog ceev tshaj C rau cov haujlwm ua lej vim yog txoj hauv kev nws ua haujlwm nco cov ntaub ntawv ( C pointers yog qhov nyuaj rau optimize). Ntawm qhov tod tes, C ++ tuaj yeem ua tau zoo li ceev raws li C , tab sis muaj ntau yam kev ua haujlwm siab dua. Nws yog a ntau dua tshiab lus , los ntawm nruab nrab 80-s.

Qhov thib ob, C ++ ceev npaum li cas?

Ua ntev, complex suav thiab tshwj xeeb nrog txoj hlua tuav, C++ tuaj yeem yog ob mus rau tsib zaug sai dua tshaj C#, yog sau rau hauv cov cai zoo tshaj plaws. Tab sis C# yog ib tug ntse compiler uas tuaj yeem kho qhov chaws zoo heev thiab tuaj yeem ua qee qhov kev dag ntxias kom ua kom cov txheej txheem.

Puas yog C ua haujlwm zoo dua li C ++?

Koj kawm tau dab tsi: C yog qee yam zoo dua C++ hauv ceev thiab efficiency . Nws yooj yim dua rau code thiab debug hauv C mas C ++. C yog qhov kev xaiv vim li cas rau qhov kev pab cuam theem, xws li kernel programming, tsav tsheb thiab lwm yam.