Non-Confidential | ![]() | 100067_0609_00_en | ||
| ||||
Home > Compiler-specific Function, Variable, and Type Attributes > __attribute__((used)) variable attribute |
This variable attribute informs the compiler that a static variable is to be retained in the object file, even if it is unreferenced.
Data marked with __attribute__((used))
is
tagged in the object file to avoid removal by linker unused section removal.
Static functions can also be marked as used, by using __attribute__((used))
.
static int lose_this = 1; static int keep_this __attribute__((used)) = 2; // retained in object file static int keep_this_too __attribute__((used)) = 3; // retained in object file