summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-23 22:23:58 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-23 22:23:58 +0000
commit9802ce8bd2a3df806b3f5a513422f5677e3ba9ca (patch)
treee6b4b0d5650faa5f3d587281ffa288507c80c58b
parentf51ad04324b66403a872c8b4a8c343d19059273f (diff)
downloadruby-9802ce8bd2a3df806b3f5a513422f5677e3ba9ca.tar.gz
* object.c (rb_obj_hash): Added note that the hash value is not
deterministic on Marc-Andre's suggestion. Expanded description of the purpose of the hash method. [Bug #6068] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--object.c19
2 files changed, 17 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 6df87cb716..c3e8eeb46a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Feb 24 06:21:15 2012 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (rb_obj_hash): Added note that the hash value is not
+ deterministic on Marc-Andre's suggestion. Expanded description of
+ the purpose of the hash method. [Bug #6068]
+
Thu Feb 23 23:01:21 2012 Tanaka Akira <akr@fsij.org>
* ext/dbm/extconf.rb: unused macro removed.
diff --git a/object.c b/object.c
index a981319e37..697e569d41 100644
--- a/object.c
+++ b/object.c
@@ -101,14 +101,17 @@ rb_obj_equal(VALUE obj1, VALUE obj2)
}
/*
- * Generates a <code>Fixnum</code> hash value for this object.
- * This function must have the property that a.eql?(b) implies
- * a.hash <code>==</code> b.hash.
- * The hash value is used by class <code>Hash</code>.
- * Any hash value that exceeds the capacity of a <code>Fixnum</code> will be
- * truncated before being used.
- *
- * "waffle".hash #=> -910576647
+ * Generates a Fixnum hash value for this object. This function must have the
+ * property that <code>a.eql?(b)<code> implies <code>a.hash == b.hash</code>.
+ *
+ * The hash value is used along with #eql? by the Hash class to determine if
+ * two objects reference the same hash key. Any hash value that exceeds the
+ * capacity of a Fixnum will be truncated before being used.
+ *
+ * The hash value for an object may not be identical across invocations or
+ * implementations of ruby. If you need a stable identifier across ruby
+ * invocations and implementations you will need to generate one with a custom
+ * method.
*/
VALUE
rb_obj_hash(VALUE obj)