[Bf-committers] Klocwork source analysis

Alexander Ewering blender at instinctive.de
Sun Dec 3 17:07:48 CET 2006


On Sun, 3 Dec 2006, [ISO-8859-1] Mathias Panzenböck wrote:

> Alexander Ewering wrote:
>> On Sun, 3 Dec 2006, [ISO-8859-1] Mathias Panzenb?ck wrote:
>>
>>> Maybe assert(ptr); would be a sufficient solution?
>>
>> And what is that "assert()" supposed to do?
>>
>
> Well, when a function which is not supposed to get a NULL pointer gets NULL, then there is obviously
> something very wrong in the source! How can such a error be recovered? In most cases it can't!
> So the best thing would be to give a back trace and shutdown blender (maybe *try* to save a backup
> of the file, but do not overwrite the file, because of this error a corruption could be possible).
> Maybe you can tell the user to send a (maybe automated) error report including this back trace and
> maybe other informations to the blender developers (like amarok dose on seg.faults).
>
> Therefore some kind of assert-function which does those things would be IMHO nice to have.

There is no need for such an assert() function in Blender, because Blender
wraps all malloc calls anyway.

Anyway, this has been discussed to death in the past and I think we should
just stick to "The current state is horrible, and when we write new code, do
it better and check if memory allocations succeeds" ;)

| alexander ewering              instinctive mediaworks
| xx-mail.com/instinctive     http://www.instinctive.de


More information about the Bf-committers mailing list