Hello All,

The C++ skeleton contains a value_type struct if %define api.value.type
variant is selected. This type has a char yyraw_[size] data member that
serves as raw storage for the various semantic types.
When the value_type struct is default initialized, this member is
zero-initialized. This zero-initialization seems redundant to me, as the
raw storage will anyway be overwritten by some valid semantic value later.
It is not checked for its content, as the current semantic type held by it
is stored elsewhere.
Since this object is allocated quite often, removing the zero
initialization is a noticeable gain (have measured), especially if one of
the semantic types is a bit larger.

This patch removes this zero initialization from variant.hh.

diff --git a/data/skeletons/variant.hh b/data/skeletons/variant.hh
index 98a0b3c..50f88bf 100644
--- a/data/skeletons/variant.hh
+++ b/data/skeletons/variant.hh
@@ -108,8 +108,7 @@ m4_define([b4_value_type_declare],
     typedef value_type self_type;

     /// Empty construction.
-    value_type () YY_NOEXCEPT
-      : yyraw_ ()]b4_parse_assert_if([
+    value_type () YY_NOEXCEPT]b4_parse_assert_if([
       , yytypeid_ (YY_NULLPTR)])[
     {}

Reply via email to