Introduce a macro CAST_INIT to abbreviate common static_cast's a bit

This macro doesn't work with type names containing commas, but that doesn't
seem to be too common in fish.
This commit is contained in:
Cheer Xiao 2013-01-01 01:27:27 +08:00
parent 424bb589a2
commit 78ab7e7ba1

View file

@ -22,6 +22,12 @@
#include <assert.h> #include <assert.h>
#include "util.h" #include "util.h"
/**
Avoid writing the type name twice in a common "static_cast-initialization".
Caveat: This doesn't work with type names containing commas!
*/
#define CAST_INIT(type, dst, src) type dst = static_cast<type >(src)
class completion_t; class completion_t;
/* Common string type */ /* Common string type */