www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3852] New: Default struct constructors needed

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 puremagic.com
        ReportedBy: samukha voliacable.com



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: -------
Feb 25 2010