freetype
[Top][All Lists]
Advanced

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

Re: [ft] FT_Done_Face Should Not Return An Error


From: Werner LEMBERG
Subject: Re: [ft] FT_Done_Face Should Not Return An Error
Date: Sat, 05 May 2018 20:10:43 +0200 (CEST)

>> It is common for object-disposal routines to never return error
>> statuses. The archetypal example is free(3)
>> <https://linux.die.net/man/3/free>.  If this is passed a valid
>> pointer, it disposes of the object; if it is passed NULL, it
>> quietly returns without doing anything.  If it is passed an invalid
>> pointer, then this indicates a program bug, so there is no point
>> returning an error code anyway: better to report an error message
>> to stderr and even abort the program.

I agree with Gregor: A library should not call `exit' by itself.

>> [...]  Otherwise, if it is passed NULL, it should just quietly
>> return without doing anything.  This makes it easier to write code
>> that initializes all temporary pointers up front and
>> unconditionally disposes them at the end; there is no need to
>> tediously check everything for NULL pointers, because the disposal
>> routines will take care of that.

It's not clear to me how such a situation can arise with FreeType.
Please give an example.


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]