On Fri, 2008-07-04 at 13:14 +0000, [EMAIL PROTECTED] wrote: > Author: gsim > Date: Fri Jul 4 06:14:06 2008 > New Revision: 674040 > > URL: http://svn.apache.org/viewvc?rev=674040&view=rev > Log: > Allow default values for packed structs to be overridden (currently used for > message.transfer.accept-mode) > > > Modified: > incubator/qpid/trunk/qpid/cpp/rubygen/framing.0-10/structs.rb > > Modified: incubator/qpid/trunk/qpid/cpp/rubygen/framing.0-10/structs.rb > URL: > http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/framing.0-10/structs.rb?rev=674040&r1=674039&r2=674040&view=diff > ============================================================================== > --- incubator/qpid/trunk/qpid/cpp/rubygen/framing.0-10/structs.rb (original) > +++ incubator/qpid/trunk/qpid/cpp/rubygen/framing.0-10/structs.rb Fri Jul 4 > 06:14:06 2008 > @@ -48,7 +48,7 @@ > > def default_initialisation(s) > params = s.fields.select {|f| ValueTypes.include?(f.cpptype.name) || > (!is_packed(s) && f.type_ == "bit")} > - strings = params.collect {|f| "#{f.cppname}(0)"} > + strings = params.collect {|f| "#{f.cppname}(#{f.default_value})"} > strings << "flags(0)" if (is_packed(s)) > if strings.empty? > return "" >
Actually the compiler should be able to apply the "elided copy optimization" here, so this may not have any performance impact at all on optimized code.
