about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-17 18:34:15 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-17 18:34:15 -0700
commit8952c52e1ba5e8ffbf06553f1695607ccc8d38d6 (patch)
treea4f2fe78fc550f3f79377562a0947f161d066ac6
parentc9fe6ddb89cb31b6c47961ab1e581a10dd60ffb3 (diff)
downloadmu-8952c52e1ba5e8ffbf06553f1695607ccc8d38d6.tar.gz
1395
-rw-r--r--001help.cc5
1 files 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<long long int>(X.size())
+#define SIZE(X) (assert(X.size() < 1LL<<62), static_cast<long long int>(X.size()))
 
 :(before "End Includes")
 #include<assert.h>