From: Lucian Grijincu Date: Wed, 5 Oct 2016 20:49:26 +0000 (-0700) Subject: folly: deprecate StringPiece::hash X-Git-Tag: v2016.10.10.00~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c495dd260d76ece28f44033a5c151d3c1ce747bd;p=folly.git folly: deprecate StringPiece::hash Summary: It's bad mkey. Says so on the tin can. Alert/annoy its users. Reviewed By: yfeldblum, ot Differential Revision: D3973625 fbshipit-source-id: 23f4e16182749d016084fcb378a1170ff402c259 --- diff --git a/folly/Range.h b/folly/Range.h index 0ca0f615..97a7f1d0 100644 --- a/folly/Range.h +++ b/folly/Range.h @@ -442,6 +442,19 @@ public: // (The above advice does not apply if you are targeting a 32-bit system.) // // Works only for Range and Range + // + // + // ** WANT TO GET RID OF THIS LINT? ** + // + // A) Use a better hash function (*cough*folly::Hash*cough*), but + // only if you don't serialize data in a format that depends on + // this formula (ie the writer and reader assume this exact hash + // function is used). + // + // B) If you have to use this exact function then make your own hasher + // object and copy the body over (see thrift example: D3972362). + // https://github.com/facebook/fbthrift/commit/f8ed502e24ab4a32a9d5f266580 + FOLLY_DEPRECATED("Replace with folly::Hash if the hash is not serialized") uint32_t hash() const { // Taken from fbi/nstring.h: // Quick and dirty bernstein hash...fine for short ascii strings