This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/7] Class-fy partial_die_info


>>>>> "Yao" == Yao Qi <qiyaoltc@gmail.com> writes:

Yao> @@ -18353,7 +18392,8 @@ load_partial_dies (const struct die_reader_specs *reader,
Yao>        struct partial_die_info *part_die
Yao>  	  = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
 
Yao> -      memcpy (part_die, &pdi, sizeof (pdi));
Yao> +      part_die = new (part_die) partial_die_info (pdi);
Yao> +

I wonder if it would make sense to have an "operator new" implementation
that allocates directly on an obstack.  It could use
std::is_trivially_destructible to enforce the rule that objects on an
obstack can't really be destroyed.  This would eliminate the separate
XOBNEW, which is maybe a potential source of errors; and would also make
it harder to accidentally add a destructor to objects allocated this way.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]