This variable attribute enables you to specify multiple aliases
for variables.
Where a variable is defined in the current translation unit,
the alias reference is replaced by a reference to the variable,
and the alias is emitted alongside the original name. Where a variable is
not defined in the current translation unit, the alias reference
is replaced by a reference to the real variable. Where a variable
is defined as static, the variable name is replaced
by the alias name and the variable is declared external if the alias
is declared external.
Note
Function names might also be aliased using the corresponding
function attribute __attribute__((alias)).
Syntax
type newname __attribute__((alias("oldname")));
where:
oldname
is the name of the variable to be aliased
newname
is the new name of the aliased variable.
Example
#include <stdio.h>
int oldname = 1;
extern int newname __attribute__((alias("oldname"))); // declaration
void foo(void)
{
printf("newname = %d\n", newname); // prints 1
}
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.