A little complaint about C + +

Source: Internet
Author: User

A period of time do not write C + + code, write it feel a little strange, especially for C + + template implementation is not the bottom of the heart, a variety of errors appear, efficiency let me have some regret the original project adopted C + + and a large number of use of STL.

However, after all, the project has been molded, completely demolished and pure C refactoring in time and energy is not feasible. Choose a language, it is like choosing a lover, even if later feel not very gratified, or to persist to the end. Fortunately, the choice of language is only on a project, with the end of the project, and the Lover is a lifetime, should be more careful choice:).

Trouble, reread Daniel Linus shelling C + + of the text, consolation.

 from:Linus Torvalds <torvalds <at> linux-foundation.org>Subject:Re: [RFC] Convert builin-mailinfo.c to use the Better String Library.Newsgroups:Gmane.comp.version-control.gitDate:2007-09-06 17:50:28 GMT (2 years, weeks, hours and minutes ago)On Wed,5Sep -, Dmitry Kakurin wrote:> > when I FirstLooked atGit source code Things struckMe  asOdd:>1.Pure C asOpposed toC++. No idea why. Please don ' t talk AboutPortability,>it' s bs.*you* is full ofBullshit. C++ isA horrible language. It ' s made more horrible by  theFact thatA lot ofSubstandard programmers useit, to  thePointwhere it' s much much easier toGenerate Total andUtter crap with it. Quite Frankly, evenif  theChoice ofC were toDo *nothing* butKeep theC + + programmers out, that inchitself would be a huge reason toUse c.in Otherwords: theChoice ofC is  theOnly sane choice. I know Miles Bader jokingly said"to piss you off", but it' s actuallytrue. I ' ve come to  theConclusion thatAny programmer thatWould prefer theProject toBeinchC++ OverC isLikely a programmer thatI really *would* prefer toPiss off, so thatHe doesn ' t come andScrew up any project I ' m involved with. C + + Leads toReally really bad design choices. You invariably start using the "Nice"Library features of  theLanguage like STL andBoost andOther Total andUtter crap, thatMay"Help"Program, butCauses:-Infinite amounts ofPain when they don ' t work ( andAnybody who tellsMe     thatStl andEspecially Boost is stable andPortable isJust so full ofBs that it' s notEven funny)-inefficient abstracted programming modelswhereYears down theRoad you notice that someAbstraction wasn ' t very efficient, butNow all your code depends onAll theNice object Modelsaround it, andYou cannot fixit withoutRewriting your app. In otherwords, theOnly toDo good, efficient, andSystem-level andPortable C + + ends up toLimit yourself toAll theThings thatis basically availableinchC. and limiting your project toC means thatPeople don ' t screw thatUp andalso means thatYouGetA lot ofProgrammers thatDo actually understand low-level issues andDon ' t screw things up withAny idiotic"Object Model"Crap. So I ' m sorry, but  forSomething like Git,whereEfficiency was a primary objective, the "Advantages"  ofC++ isJust a huge mistake. The fact thatWe also piss off people who cannot see that  isJust a big additional advantage. If you want a VCS that  isWritteninchC + +, go play withMonotone. Really. They use a"Real Database". They use"Nice object-oriented Libraries". They use"Nice C + + abstractions". And quite frankly, asAresult  ofAll these design decisions thatSound so appealing to someCS people, the End result  isA horrible andUnmaintainable mess. But I ' m sure you ' d likeitMore than Git. Linusfrom:linus TorvaldsSubject:Re:Compiling C + + kernel module + Makefiledate:mon, +Jan2004  A: $: at-0800(PST) On Tue, -Jan2004, Robin Rosenberg wrote:> > this is  the "We ' ve always used Cobol^h^h^h^h"Argument. In fact,inchLinux we didTryC + + once already, Back inch 1992.It sucks. TrustMe-Writing Kernel codeinchC++ isA BLOODY STUPID idea. The fact is, C + + compilers is notTrustworthy. They were even worseinch 1992, but someFundamental Facts haven ' t changed:- theWhole C + + exception handling thing isFundamentally broken. It ' s _especially_ broken forKernels. -any compilerorLanguage thatLikes toHide things like memory allocationsbehindYour BackJustisn ' tA good choice forA kernel. -You canWriteObject-oriented Code (useful forFilesystems etc)inchC, _without_ theCrap that  isC++. In general, I ' dsay  thatAnybody who designs he kernel modules forC++ isEither (a) looking forProblems (b) A C + + bigot thatCan ' t see what he isWriting isReally just C anyway (c) wasgivenAn assignmentinchCsclass  todo so. Feel free toMake up (d). Linus

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

A little complaint about C + +

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.