On 13/07/2012 16:23, Nikita Egorov wrote:
> Hi, there was some problem with that menu.
> IIRC, source of the problem was well known feature of C++ language: arbitrary 
> initialization order of global variables.

No,  only initialization order of the compilation units (cpp files) is 
arbitrary, in a single unit the variables are initialized in order as they 
appear in the
source. Additionally if you call a function from another unit, this call 
initializes all variables preceding this function in the unit before call is 
invoked.
This is assured by C++ and (as you probably know) and such function calls are 
commonly used to avoid initialization fiasco.

Now back to the fluid: looking into various fluid-generated code, fluid 
generates perfectly safe code regarding to such initialization fiasco.
The only problem I can see is that somebody uses or writes 
initialization-unsafe internationalization function, but but in such a case 
he/she should not enable
internalization in fluid "project settings" in the first place  - although I 
can not see how somebody would want to use non-safe i18n function, everybody 
writes
definitions like

  const char * my_string = _("My text");

so the function _() must work before main().

So I do not believe this is fluid problem. I have about 30 internationalized 
fluid files, I have looked into generated code (where widgets are constructed 
both
as a definition of class and old-fashioned way in a function call) and all code 
seems to be safe - I have never encountered initialization fiasco in fltk-1.1.
Is there any STR with a problem description? Otherwise I see no reason not to 
allow calling internationalization function during initialization of static
variables (see also my other post).

Menus are very common (not only as  Fl_Menu_Bar, but also Fl_Chooice, 
Fl_Menu_Button) and Fluid internationalization without it seems quite useless. 
I strongly
believe this should go back to fluid (at least as a checkbox option for the 
project settings).

Roman

PS: Sorry for the rant, but I feel quite frustrated and I do not know what to 
do - maybe I will use fluid from 1.1 but I am little bit worried that mixing the
two will bring compatibility problems ;(




_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to