Re: To go with Go or C/C++?
On Friday, 3 May 2013 19:22:00 UTC+1, Melzzzzz wrote:
On Fri, 03 May 2013 18:32:27 +0100
Rui Maciel <rui.maciel@gmail.com> wrote:
=D6=F6 Tiib wrote:
Also C is less efficient in the situation. When the case where
further processing is impossible occurs very rarely (is actually
exceptional) then all the eliminated error checking code in C++
makes it lot faster than same thing written in C.
Let me get this straight: you claim that C++ is more efficient
because when C++ programs crash, they crash faster?
Exceptions come with cost (runtime or space)...
Checking return codes come with cost. Significantly more
cost than exceptions in terms of runtime. As for space... extra
code is extra code, in both cases. With the difference that the
exception code is more or less generic, so while it is more
complicated than a single runtime check, it only occurs once,
where as the runtime checking occurs every time you return from
a function. Not to mention that the runtime checking is inline,
and so blows up the locality of the functions which contain it.
The one case where exception handling could have a negative
impact is in optimization. The optimizer must take into account
the extra paths of flow control, which could possibly in some
cases prevent code movement (although not that much, because C++
doesn't give you many guarantees in this regard anyway). The
effect is probably very small, however.
--
James