Michael asked what "yuck" means, so I should elaborate.

I have a mild dislike for ASSERT_EQ and friends.  C++ already has a really
expressive language for writing assertions.  This language is "C++".  I
actually prefer C++ to this Lisp-like domain specific language for
assertions made from the preprocessor.

ASSERT_EQ, etc. make it mildly annoying to refactor C++ code into an
assertion because you have to compiler from C++ to this impoverished
assertion language.  They make it annoying to turn an existing assertion
into a disjunction of assertion, because you have to decompile.  Same with
turning an ASSERT_EQ into a STATIC_ASSERT.

In the case of ASSERT_EQ/ASSERT_NE, which have the advantage of printing a
better error message to stderr (I find I nearly always have to jump into
the debugger immediately anyway, so it never seems to save any effort in
practice), we have actually had a bunch of subtle bugs around equality of
various-sized int and pointer types that meant we were not actually
asserting what we thought we were.

In the case of ASSERT_GT, ASSERT_GE, etc., they seem pointless.  The
definitions are:

#define CHECK_GT(a, b) CHECK((a) > (b))
#define CHECK_GE(a, b) CHECK((a) >= (b))
#define CHECK_LT(a, b) CHECK((a) < (b))
#define CHECK_LE(a, b) CHECK((a) <= (b))

I find the macro expansions much more readable.

-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to