diff options
author | gdt | 2008-03-17 00:48:25 +0000 |
---|---|---|
committer | gdt | 2008-03-17 00:48:25 +0000 |
commit | 7aa3a0579962ef00880987050164c64c948c9f14 (patch) | |
tree | fcc0049cf656541c7d13bd7ab2db86b8316c2080 /gnuradio-core/src/lib | |
parent | 00f4fd98fb3532e3a15f92c6403bebe878075f5e (diff) | |
download | gnuradio-7aa3a0579962ef00880987050164c64c948c9f14.tar.gz gnuradio-7aa3a0579962ef00880987050164c64c948c9f14.tar.bz2 gnuradio-7aa3a0579962ef00880987050164c64c948c9f14.zip |
Don't define RANDOM_MAX on systems that have already defined it. (At
present, only NetBSD-current is known to do this.) Improve the
comment explaining the situation.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8034 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r-- | gnuradio-core/src/lib/general/random.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gnuradio-core/src/lib/general/random.h b/gnuradio-core/src/lib/general/random.h index c5f6683de..c643c3e42 100644 --- a/gnuradio-core/src/lib/general/random.h +++ b/gnuradio-core/src/lib/general/random.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003, 2008 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,9 +23,15 @@ #ifndef _RANDOM_H_ #define _RANDOM_H_ -// we use this because some systems (solaris) define RAND_MAX as 32767 +// While rand(3) specifies RAND_MAX, random(3) says that the output +// ranges from 0 to 2^31-1 but does not specify a macro to denote +// this. We define RANDOM_MAX for cleanliness. We must omit the +// definition for systems that have made the same choice. (Note that +// random(3) is from 4.2BSD, and not specified by POSIX.) -static const int RANDOM_MAX = 2147483647; +#ifndef RANDOM_MAX +static const int RANDOM_MAX = 2147483647; // 2^31-1 +#endif /* RANDOM_MAX */ #include <stdlib.h> |