[Gnucash-changes] QOF/CashUtil Sync: Engine

Christian Stimming stimming at tuhh.de
Wed Aug 17 08:29:55 EDT 2005


Derek Atkins schrieb:
> Anyways, some more comments..  When you create a public API,
> you cannot assume the arguments will be valid.  In particular:

Seconded.

> Rule of thumb: if it's a public function, always check your arguments.
> If it's a *static* function then you can sometimes get away with not
> checking them, but you should still check them anyways.

Or, put another way: The time spent for adding the additional check in 
the program code is definitely negligible compared to the debugging 
effort once someone (including yourself) accidentally passes NULL as an 
argument, and instead of the argument check you run into some very 
strange behaviour. You simply save a whole lot of time if you regularly 
check your arguments (usually g_assert() might be just enough). I just 
encourage you to follow Dereks advice here...

Cheers,

Christian


More information about the gnucash-devel mailing list