Function Macro

GLibGNUC_ALLOC_SIZE2

Declaration [src]

#define G_GNUC_ALLOC_SIZE2 (
  x,
  y
)

Description [src]

Expands to the GNU C alloc_size function attribute if the compiler is a new enough gcc. This attribute tells the compiler that the function returns a pointer to memory of a size that is specified by the product of two function parameters.

Place the attribute after the function declaration, just before the semicolon.

gpointer g_malloc_n (gsize n_blocks,
                     gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1, 2);

See the GNU C documentation for more details.

Available since:2.18

Parameters

x -
 

The index of the argument specifying one factor of the allocation size.

y -
 

The index of the argument specifying the second factor of the allocation size.