[Bf-committers] Using assert()?

Jason Wilkins jason.a.wilkins at gmail.com
Sat Aug 14 23:22:55 CEST 2010

I do not see any real problem with using asserts as long as they are used
the way they are intended.

You use an assert to crash a program on purpose and much earlier than it
would normally crash (or worse, no crash but may corrupt memory and act

Asserts are not present in release code, so they should never contain code
that has side effects.

An assert should never be used for ordinary error conditions that need to be
checked for delt with by the program.

An assert should be used to do checks that would cause problems in
performance critical code and you want to be confident you can remove the
checks in release versions of the code.

Used properly I would almost say you do not need permission to add asserts.
I normally add them all over the place.  Unfortunately like you I was
nervous about using them when it doesn't seem to be wide spread in Blender,
so I refrained.

More information about the Bf-committers mailing list