From 8952c52e1ba5e8ffbf06553f1695607ccc8d38d6 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 17 May 2015 18:34:15 -0700 Subject: 1395 --- 001help.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/001help.cc b/001help.cc index 25150f92..88c78d70 100644 --- a/001help.cc +++ b/001help.cc @@ -55,10 +55,9 @@ bool is_equal(char* s, const char* lit) { // Corollary: don't use the size() method on containers, since it returns an // unsigned and that'll cause warnings about mixing signed and unsigned, // yadda-yadda. Instead use this macro below to perform an unsafe cast to -// signed. (Implementation-defined behavior, so not as bad as undefined; -// should cause immediate failures on overflow by failing to enter loops.) +// signed. We'll just give up immediately if a container's every too large. :(before "End Includes") -#define SIZE(X) static_cast(X.size()) +#define SIZE(X) (assert(X.size() < 1LL<<62), static_cast(X.size())) :(before "End Includes") #include -- cgit 1.4.1-2-gfad0