11 Nov
2019
11 Nov
'19
11:27 a.m.
On 11.11.19 10:27, Mathias Gaunard via Boost wrote:
On Sun, 10 Nov 2019 at 14:16, Phil Endecott via Boost
wrote: switch (hash(s)) { case "aa"HASH: if (s=="aa") f(); break; case "ab"HASH: if (s=="ab") g(); break; case "xy"HASH: if (s=="xy") h(); break; }
That code doesn't really need to check, if your hashes collide the compiler will reject the code.
Here 's' could have a value that does not match any of the labels (but with the same hash as one of the labels), so the code does need to check. -- Rainer Deyke (rainerd@eldwood.com)