I use asserts pretty liberally. I usually use them to enforce preconditions:
void foo(int *p, char *c)
{
ASSERT(p != NULL);
ASSERT(c != NULL);
// body
}
Of course, it's been a while since I've used asserts as I favor languages with SEH. I therefore do something like the following:
void foo(Foo f, int c)
{
if (f == null) throw new ArgumentNullException("...");
if (c < 0) throw new ArgumentOutOfRangeException("...");
// body
}
Even better are interception techniques of Aspect-Oriented Programming (AOP) using a declarative syntax to annotate method definitions. e.g. in C#:
[Requires("f != null")]
[Requires("c >= 0")]
void foo(Foo f, int c)
{
// body
}
Then again, we could all just use
Eiffel and its design-by-contract facilities and get all of this for free?