[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8034 - gnuradio/trunk/gnuradio-core/src/lib/general
From: |
gdt |
Subject: |
[Commit-gnuradio] r8034 - gnuradio/trunk/gnuradio-core/src/lib/general |
Date: |
Sun, 16 Mar 2008 18:48:26 -0600 (MDT) |
Author: gdt
Date: 2008-03-16 18:48:25 -0600 (Sun, 16 Mar 2008)
New Revision: 8034
Modified:
gnuradio/trunk/gnuradio-core/src/lib/general/random.h
Log:
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.
Modified: gnuradio/trunk/gnuradio-core/src/lib/general/random.h
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/random.h 2008-03-16
22:09:12 UTC (rev 8033)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/random.h 2008-03-17
00:48:25 UTC (rev 8034)
@@ -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>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8034 - gnuradio/trunk/gnuradio-core/src/lib/general,
gdt <=