Re: Testing on NULL an unitialized values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Zitat von "Tor Lillqvist" <tml@xxxxxx>:

>> The test
>>   if( template )
>> makes only sense, if you can be sure that uninitialzed values
>> will definitelky be NULL.
>
> You must have missed the g_return_val_if_fail (! template ||
> GIMP_IS_CONTEXT (template), NULL) .
>
> It checks if template is NULL or a pointer to a valid GimpContext. If
> template is some random non-NULL value, the test will fail and a
> warning message will be printed. Such warning messages indicate a
> programmer error and should be dealt with during development.
[...]

Nice to know, but I was talking on things like the *context
in that funcion.

Even only temporarily valies, if set to a certain value,
like 0 or NULL, will help in finding problems.

The mentioned function just was an example.

Uninitialzed values I see nearly everywhere in the code.

Dereferencing NULL is easy to find, because it crashes early.

Ciao,
    Oliver

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux