Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Stefan Reuther Newsgroups: comp.arch.embedded Subject: Re: reasons for preferring C over C++ Date: Fri, 17 Oct 2014 18:43:26 +0200 Lines: 30 Message-ID: References: <543ead04$0$15847$e4fe514c@dreader35.news.xs4all.nl> <543ee787$0$6849$e4fe514c@dreader36.news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Trace: individual.net OehR1EUylx5I6h8oVFojUwc39f8utJe/8V4PgweHfXV6xF91Zm Cancel-Lock: sha1:xS3Z3JP+9osEFuCXfkbOTKj0oFM= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3.1) Gecko/20030425 Hamster/2.0.6.0 X-Accept-Language: de-de, de, en-us, en In-Reply-To: Xref: csiph.com comp.arch.embedded:18736 Hans-Bernhard Bröker wrote: > Am 16.10.2014 um 18:19 schrieb Stefan Reuther: >> If that is a problem, it is a consequence of the semantic distance to >> the machine, as you put it: if a single line of code can generate a few >> hundred machine instructions, have a lot of fun debugging what exactly >> caused the program to generate a SIGSEGV in the middle of that. > > ... and consider yourself a lucky bastard if the problem was as brutally > evident as a SIGSEGV. Now try debugging a tiny, yet inacceptable > numerical inaccuracy in such an environment. Or a random, > about-once-every-three-hours, timing infraction that's been known never > to happen when the debugger is attached to the program. Last time I had that was in C, and was fixed by -ffloat-store :-) > Among computing tools, the programming language C has been said to be > the analog of a surgical scalpel: [...] > > If I try to extend that analogy in the direction of C++, my imagination > tries to bring up some nightmarish contraption like a handheld, > large-diameter buzz saw with scalpel blades for teeth, a 20 kW engine > and nitro-glycerine for fuel: [...] C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off. -- Bjarne Stroustrup Stefan