Re: return value checking for GTK APIs



brahmaiah vallabhaneni wrote:

Hi All,
I am new to Linux GUI programming and started going
through the tutorial.

But I have observed one strange coding style (to me).
Usually, when we call a function say malloc, we always validate the return value before it's use.

But in GTK samples, they do n't check the return
value of APIs. Any specific reason ?

If you're talking about g_malloc*() (or another functions based on it) - yes,
there's one good reason - it will terminate your app with an error message
if memory allocation fail.

Olexiy





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