On Sun, 2014-06-15 at 11:39 -0700, Edward Hennessy wrote:
> On Jun 14, 2014, at 4:20 PM, Maciej Piechotka 
> <[email protected]> wrote:
> > 
> > As a side question - why do you need volatile? In most cases it's not
> > needed (unless you write kernel/driver and do memory based I/O).
> > 
> 
> I've run into the issue calling functions with side effects. Here is a 
> snippet of my code with the workaround:
> 
> 
>         /* Need to register types with the glib type system for dynamic
>          * construction with gtkbuilder. Need to figure out a better way
>          * to ensure the calls to typeof() are not optimized out.
>          */
> 
>         stdout.printf("Registering %s\n", typeof(AboutDialog).name());
>         stdout.printf("Registering %s\n", typeof(AddSimulationDialog).name());
>         stdout.printf("Registering %s\n", 
> typeof(ArchiveSchematicsDialog).name());
>         stdout.printf("Registering %s\n", typeof(ExportBOMDialog).name());
>         stdout.printf("Registering %s\n", typeof(ExportNetlistDialog).name());
>         stdout.printf("Registering %s\n", typeof(NewDesignDialog).name());
>         stdout.printf("Registering %s\n", typeof(NewProjectDialog).name());
>         stdout.printf("Registering %s\n", 
> typeof(RenumberRefdesDialog).name());
>         stdout.printf("Registering %s\n", typeof(ResetRefdesDialog).name());
>         stdout.printf("Registering %s\n", 
> typeof(BackannotateRefdesDialog).name());
> 
> Cheers,
> Ed

Technically that's workaround of a workaround. C compiler should not
optimize it but we promised that this time about_dialog_get_type ()
really is a pure function. 

Probably a better way is typeof(AbountDialog).class_ref() ot
typeof(AboutDialog).class_peek().

Regards


Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to