Question about version ( ) keyword
Kagamin via Digitalmars-d
digitalmars-d at puremagic.com
Mon Mar 21 10:18:19 PDT 2016
On Monday, 21 March 2016 at 14:51:48 UTC, Vincent R wrote:
> When I see this code I cannot help thinking of something like:
>
> version( CRuntime_Glibc ) || version( FreeBSD ) || version
> (Solaris)
> {
> if(version(Solaris))
> enum PTHREAD_BARRIER_SERIAL_THREAD = -2;
> else
> enum PTHREAD_BARRIER_SERIAL_THREAD = -1;
>
> int pthread_barrier_destroy(pthread_barrier_t*);
> int pthread_barrier_init(pthread_barrier_t*, in
> pthread_barrierattr_t*, uint);
> int pthread_barrier_wait(pthread_barrier_t*);
> int pthread_barrierattr_destroy(pthread_barrierattr_t*);
> int pthread_barrierattr_getpshared(in
> pthread_barrierattr_t*, int*);
> int pthread_barrierattr_init(pthread_barrierattr_t*);
> int pthread_barrierattr_setpshared(pthread_barrierattr_t*,
> int);
> }
> else version (OSX) ||version (CRuntime_Bionic)
> {
> }
> else
> {
> static assert(false, "Unsupported platform");
> }
Even shorter:
version(Solaris)
enum PTHREAD_BARRIER_SERIAL_THREAD = -2;
else
enum PTHREAD_BARRIER_SERIAL_THREAD = -1;
int pthread_barrier_destroy(pthread_barrier_t*);
int pthread_barrier_init(pthread_barrier_t*, in
pthread_barrierattr_t*, uint);
int pthread_barrier_wait(pthread_barrier_t*);
int pthread_barrierattr_destroy(pthread_barrierattr_t*);
int pthread_barrierattr_getpshared(in pthread_barrierattr_t*,
int*);
int pthread_barrierattr_init(pthread_barrierattr_t*);
int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
More information about the Digitalmars-d
mailing list