[bind10-dev] assertions, exceptions

Michael Graff mgraff at isc.org
Tue May 25 17:11:34 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As I mentioned on the con call, I think assert() is fine if:

(1)  It is checking for things that are internal to your class, that are
pure programmer errors.

(2)  There is no way a caller can modify your state in such a way that
you will trigger this assert(), unless it is a programmer error in your
class.

(3)  You don't use them where you really want to raise an exception.
Examples are "I cannot fit 50 bytes into this buffer" should throw an
exception, but "my class says there are 60 bytes free in my internal
counter, but I have a NULL pointer for the buffer" sounds like a
programmer error.

- --Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkv8BMYACgkQ+NNi0s9NRJ0ueQCgjHwVZzkIeXaNuJIfQ5kl+GGO
DBsAnj88avpl0n+ItffUr9ggI8btqwO0
=VS8E
-----END PGP SIGNATURE-----



More information about the bind10-dev mailing list