Comment fonctionne exactement __attribute__((constructeur)) de travail?

Il semble assez clair qu'il est censé mettre les choses en place.

  1. Quand exactement t-il fonctionner?
  2. Pourquoi il y a deux parenthèses?
  3. Est __attribute__ une fonction? Une macro? Syntaxe?
  4. Fait ce travail en C? C++?
  5. La fonction, il fonctionne avec le besoin d'être statique?
  6. Quand __attribute__((destructor)) exécuter?

Exemple en Objective-C:

__attribute__((constructor))
static void initialize_navigationBarImages() {
  navigationBarImages = [[NSMutableDictionary alloc] init];
}

__attribute__((destructor))
static void destroy_navigationBarImages() {
  [navigationBarImages release];
}
InformationsquelleAutor Casebash | 2010-01-12