← Back to team overview

kicad-developers team mailing list archive

Re: Static initialization order fiasco

 

On Sun, Apr 13, 2014 at 07:53:23AM -0500, Dick Hollenbeck wrote:
>   const wxChar NETCLASS::Default[] = wxT( "Default" );
> 
> instead of
> 
>   const wxString NETCLASS::Default = wxT( "Default" );
> 
> This defers the construction of the wxString until actually used, and removes the wxString
> static constructor from the race.

Wouldn't this re-construct the wxString from scratch every time that
value is used (maybe indirectly unless the overloaded functions are
really smart, working with a char array instead of building a string and
revert to the general case)?

Performance would be probably acceptable anyway but I don't like it very
much (considering that something called 'default' would be probably used
quite a lot).

IIRC you had performance issues with strings in the sexp parser, in the
past.

-- 
Lorenzo Marcantonio
Logos Srl


Follow ups

References