[bind10-dev] whether/when to use exceptions
David W. Hankins
dhankins at isc.org
Wed Oct 14 19:13:16 UTC 2009
On Wed, Oct 14, 2009 at 01:55:33PM -0400, Christos Zoulas wrote:
> Well, my personal experience with pretty good c++ programmers
> writing c++ with exceptions has not been good, that's why where
> I work they are not allowed to do this anymore. YMMV. Why don't you
> write the whole thing in java if you want exceptions? Well written
> java can be as fast as c++ after the warmup period.
I don't know what the committee's reasoning was. I think it might
have had to do with the availability of native compilers.
I do like Java's copy-on-write-construction by default for every
variable, however, as it frees you from having to worry about
programmers spamming the stack with copy constructions on function
calls (which sounds to me is what happened in your case).
Getting that sort of thing in C++ or C is cumbersome.
Note that many of the IP Address handling functions in ISC DHCP pass
in whole structures rather than const pointers to structures.
I think I would not have protested (much) if those structures were
4 octets in length to record an IPv4 address, however, they aren't.
They are actually 16+sizeof(int) octets in length, and they are data,
so they must be copied through stack rather than passed as pointers
do; in registers up to the ABI limit. This must be done whether the
function you called is using the data, or passing it to the next
utility function (where a copy on stack is again made).
So, there is an existence proof that you can make the same mistakes in
C. Java does make this mistake impossible.
--
David W. Hankins "If you don't do it right the first time,
Software Engineer you'll just have to do it again."
Internet Systems Consortium, Inc. -- Jack T. Hankins
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20091014/101dd625/attachment.bin>
More information about the bind10-dev
mailing list