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 ""


This fix will result in things like:

Foo() : fooString(std::string()) {}

Which is correct but stylistically odd and from a performance viewpoint
invokes a default ctor + a copy ctor instead of just a default. That's
what I was trying to avoid in the more complicated patch. We should
verify the performance impact - if there is none then maybe we can leave
it that way. 

Reply via email to