http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/
__attribute__
The keyword
__attribute__
allows you to specify special attributes of variables or structure fields. This keyword is followed by an attribute
specification inside double parentheses.
關鍵字__attribute__允許我們指定變量或結構體內各個域的屬性。使用時在__attribute__後面加上被雙括號括起來的屬性說明
unused
This attribute, attached to a variable, means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable
int unuse __attribute__ ((unused));
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes
constructor
destructor
constructor (
priority)
destructor (
priority)
用於函數修飾。constructor修飾的函數在main之前運行,若帶priority(整數),則priority小的先運行。destructor修飾的函數在main執行後或exit調用後
執行,若帶priority(整數),執行順序與constructor相反,大的先執行
用法: 1、 __atribute((constructor(101))) void func() { ... } 2、 void func() __atribute((constructor(101))); void func() { ... }
setlocale
On program startup, the locale selected is the "C" locale
, which is the same as would
be set by calling setlocale(LC_ALL,"C")
.
LC_CTYPE | Affects character handling functions (all functions of <cctype>, except isdigit and isxdigit), and the multibyte and wide character functions. |