Function Macro

GLibSOURCE_FUNC

since: 2.58

Declaration

#define G_SOURCE_FUNC (
  f
)

Description

Cast a function pointer to a GSourceFunc, suppressing warnings from GCC 8 onwards with -Wextra or -Wcast-function-type enabled about the function types being incompatible.

For example, the correct type of callback for a source created by g_child_watch_source_new() is GChildWatchFunc, which accepts more arguments than GSourceFunc. Casting the function with (GSourceFunc) to call g_source_set_callback() will trigger a warning, even though it will be cast back to the correct type before it is called by the source.

Available since: 2.58

This function is not directly available to language bindings.

Parameters

f

Type: -

A function pointer.