changment du nom de namespace
Bonjour ,
J'ai le code suivant:
il y a un commentaire qui indique les changements à faire en fonction de la version de GCC dans le code ci-dessous . Que dois-je apporter comme un changement.
Je vous remercie.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#ifndef INDRI_ATOMIC_HPP
#define INDRI_ATOMIC_HPP
#ifndef WIN32
#if HAVE_BITS_ATOMICITY_H
#include <bits/atomicity.h>
#endif
#if HAVE_EXT_ATOMICITY_H
#include <ext/atomicity.h>
#endif
#endif
namespace indri {
/*! \brief Atomic actions for thread support */
namespace atomic {
#ifdef WIN32
typedef volatile LONG value_type;
inline void increment( value_type& variable ) {
::InterlockedIncrement( &variable );
}
inline void decrement( value_type& variable ) {
::InterlockedDecrement( &variable );
}
#else
// GCC 3.4+ declares these in the __gnu_cxx namespace, 3.3- does not.
#if P_NEEDS_GNU_CXX_NAMESPACE
#define __atomic_add __gnu_cxx::__atomic_add
#endif
typedef _Atomic_word value_type;
inline void increment( value_type& variable ) {
__atomic_add( &variable, 1 );
}
inline void decrement( value_type& variable ) {
__atomic_add( &variable, -1 );
}
#endif
}
}
#endif // INDRI_ATOMIC_HPP |