Apple Darwin Manuel d'utilisateur Page 16

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 68
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 15
Before you begin to update your code, you should familiarize yourself with the document Mac Technology
Overview . After reading that document, the first thing you should do is compile your code with the -Wall
compiler flag and fix any warnings that occur. In particular, make sure that all function prototypes are in scope,
because out-of-scope prototypes can hide many subtle portability problems.
At a high level, to make your code 64-bit clean, you must do the following:
Avoid assigning 64-bit long integers to 32-bit integers.
Avoid assigning 64-bit pointers to 32-bit integers.
Fix alignment issues caused by changes in data type sizes.
Avoid pointer and long integer truncation during arithmetic operations.
General Programming Tips
This section contains some general tips for making your code 64-bit clean.
Update architecture-specific code. If your software contains any architecture-specific code, you must either
add extra code for each additional architecture or modify your preprocessor directives so that the same code
is included for multiple supported architectures.
Unless you are including inline assembly language code, you should generally test for the presence of
architecture-neutral macros such as __LITTLE_ENDIAN__ or __LP64__ rather than testing for a specific
processor architecture.
The macro __LP64__ can be used to test for LP64 compilation in an architecture-independent way. For example:
#ifdef __LP64__
// 64-bit code
#else
// 32-bit code
#endif
2012-12-13 | Copyright © 2004, 2012 Apple Inc. All Rights Reserved.
16
Making Code 64-Bit Clean
Vue de la page 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 ... 67 68

Commentaires sur ces manuels

Pas de commentaire