HP aC++/HP C A.06.20 Programmer's Guide

Attributes
__attribute__ is a language feature that allows you to add attributes to functions
(or with the aligned attribute, to variables or structure fields). The capabilities are
similar to those of #pragma. It is more integrated into the language syntax than pragmas
and its placement in the source code depends on the construct to which the attribute
is being applied.
The attributes supported are:
aligned
malloc
non_exposing
noreturn
format
visibility
warn_unused_result
attribute aligned
__attribute__ (aligned (alignment))
The aligned attribute specifies the minimum alignment for a variable or structure
field, measured in bytes. For example, the following declaration causes the compiler
to allocate the global variable x on a 16-byte boundary:
int x __attribute__ ((aligned (16))) = 0;
You can also specify the alignment of structure fields. For example, the following causes
the compiler to allocate the field member "x" to be aligned on a 128-byte boundary:
struct foo { int x[2] __attribute__ ((aligned (128)));}
The maximum alignment that can be specified is 128. This feature is for compatibility
with gcc.
attribute malloc
__attribute__ ((malloc))
The malloc attribute is used to improve optimization by telling the compiler that:
1. The return value of a call to such a function points to a memory location or can be
a null pointer.
2. On return of such a call (before the return value is assigned to another variable in
the caller), the memory location mentioned in 1. can be referenced only through
the function return value; e.g., if the pointer value is saved into another global
variable in the call, the function is not qualified for the malloc attribute.
3. The lifetime of the memory location returned by such a function is defined as the
period of program execution between a) the point at which the call returns and b)
the point at which the memory pointer is passed to the corresponding deallocation
150 Pragma Directives and Attributes