[Issue 3852] New: Default struct constructors needed
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 25 02:19:20 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3852
Summary: Default struct constructors needed
Product: D
Version: future
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: samukha at voliacable.com
--- Comment #0 from Max Samukha <samukha at voliacable.com> 2010-02-25 02:19:18 PST ---
Qt has quite a lot of types with pass-by-value semantics. For example, all COW
types are value types
(http://doc.trolltech.com/4.6/shared.html#list-of-classes).
Currently, QtD implements such types as classes, which implies an excessive
heap allocation happens every time a value of such a type is passed to D.
We are trying to solve this problem by wrapping Qt's value types in D structs.
Those structs must always be properly initialized via a call to Qt. It would be
incorrect to just declare a variable like this:
QString s;
We would have to force the programmer to explicitly run a function emulating
the default constructor (e.g. opCall), or expect him to suffer badly when he
forgets to do so.
Possible solutions:
1. Implement proper default constructors for structs.
2. Make it possible to forbid the use of uninitialized structs.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list