summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-03-09 07:56:22 +0000
committerJose Fonseca <jfonseca@vmware.com>2015-03-09 07:56:22 +0000
commit684771c0c8079015721ab36a5b06cd9ee8136324 (patch)
tree18e516c8eb64b5c6880043c15d29406a5e85dbc6
parent5d861fe673b5904fe2c219a4ebe71820a65181c5 (diff)
cli,common: Use static_assert where appropriate.
-rw-r--r--cli/pickle.hpp2
-rw-r--r--common/trace_writer.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/cli/pickle.hpp b/cli/pickle.hpp
index 753cd6f1..20dbb13d 100644
--- a/cli/pickle.hpp
+++ b/cli/pickle.hpp
@@ -300,7 +300,7 @@ public:
char c[8];
} u;
- assert(sizeof u.f == sizeof u.c);
+ static_assert(sizeof u.f == sizeof u.c, "double is not 8 bytes");
u.f = f;
os.put(BINFLOAT);
diff --git a/common/trace_writer.cpp b/common/trace_writer.cpp
index 37a6320b..fb3ff9ba 100644
--- a/common/trace_writer.cpp
+++ b/common/trace_writer.cpp
@@ -109,13 +109,13 @@ Writer::_writeUInt(unsigned long long value) {
void inline
Writer::_writeFloat(float value) {
- assert(sizeof value == 4);
+ static_assert(sizeof value == 4, "float is not 4 bytes");
_write((const char *)&value, sizeof value);
}
void inline
Writer::_writeDouble(double value) {
- assert(sizeof value == 8);
+ static_assert(sizeof value == 8, "double is not 8 bytes");
_write((const char *)&value, sizeof value);
}