After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686337 - Static data is not initialized until instance of class is created
Static data is not initialized until instance of class is created
Status: RESOLVED DUPLICATE of bug 543189
Product: vala
Classification: Core
Component: Code Generator: GObject
0.18.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-10-17 22:24 UTC by Maciej (Matthew) Piechotka
Modified: 2012-10-19 19:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maciej (Matthew) Piechotka 2012-10-17 22:24:30 UTC
Static data is not initialized until instance of class is created which is usually contrary to behaviour of most languages when the data is initialized before calling.

Proposed solutions:
 1. _get_type function performs part of initialization. If it was inlinable and if marked as G_UNLIKELY calling it would be a nearly no-op (just one pointer-size atomic get + compatation). This could be done either for all functions or just on by default.
 2. Create custom GOnce per static region (similar to 1. but does not enforce the initialization during typeof(X) calls)
 3. Put static members to Class structure and enforce getting them in this way (probably the most heavyweight solution in terms of performance).
Comment 1 Jürg Billeter 2012-10-19 19:11:48 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 543189 ***